UI/Website.razor

A UI Razor component that hosts a WebPanel iframe pointing to an external website. It defines a WebPanel reference, configurable VisitWebsite URL, and a BuildHash for UI rebuilds.

Http Calls
🌐 https://perkedel.netlify.app
@using Sandbox;
@using Sandbox.UI;
@inherits PanelComponent
@namespace Sandbox

<root>
	<!--<iframe src="https://perkedel.netlify.app" title="Perkedel NTLF+ASTR"></iframe>-->
	<[email protected]("https://perkedel.netlify.app");-->
	<WebPanel class="FullIframe" Url=@VisitWebsite @ref="anIframe"></WebPanel>
</root>

@code
{
	// pls inspire from
	// https://github.com/CarsonKompon/sbox-mediaplayer/blob/main/code/ui/MediaBrowser/MediaBrowser.razor
	// thancc carson.
	// https://github.com/Facepunch/sbox-public/blob/master/engine/Sandbox.Engine/Systems/UI/Controls/WebPanel.cs
	// https://github.com/Facepunch/sbox-scenestaging/blob/main/Code/Panels/UITests/Elements/WebPanelTest.razor
	/*
	<WebPanel class="FullIframe" @ref="anIframe" ></WebPanel>

	https://perkedel.netlify.app/
	*/
	public WebPanel anIframe {get;set;}

	// https://www.w3schools.com/tags/tag_iframe.asp
	[Property, TextArea] public string MyStringValue { get; set; } = "Hello World!";
	[Property] public string VisitWebsite { get; set; } = "https://perkedel.netlify.app";

	protected override void OnStart()
	{
		//anIframe.Url = VisitWebsite;
	}

	/*
	protected override void OnAfterTreeRender(bool firstTime)
	{
		if(firstTime)
		{
			anIframe.Url = VisitWebsite;
		}
	}
	*/

	/// <summary>
	/// the hash determines if the system should be rebuilt. If it changes, it will be rebuilt
	/// </summary>
	protected override int BuildHash() => System.HashCode.Combine(
		MyStringValue ,
		VisitWebsite
	);
}