Scripts/New-UDBurger.ps1
<# .SYNOPSIS Sample control for UniversalDashboard. .DESCRIPTION Sample control function for UniversalDashboard. This function must have an ID and return a hash table. .PARAMETER Id An id for the component default value will be generated by new-guid. .EXAMPLE PS C:\> <example usage> Explanation of what the example does .INPUTS Inputs (if any) .OUTPUTS Output (if any) .NOTES General notes #> function New-UDBurger { param( [Parameter()] [string]$Id = (New-Guid).ToString(), [Parameter()] [ValidateSet( "slide", "stack", "elastic", "bubble", "push", "pushRotate", "scaleDown", "scaleRotate", "fallDown", "reveal" )]$Effect = "pushRotate", #effect for menu [Parameter()] [scriptblock]$Links, #provide links for the menu [Parameter()] [scriptblock]$Content, #Content of dashboard page [Parameter()] [Switch]$Right, #Will open the menu on the right hand side [Parameter()] [string]$BurgerMarginLeft, #To position the menu more to the right [Parameter()] [string]$BurgerBackgroundColor = "#373a47", #Burger menu background [Parameter()] [string]$BurgerHoverColor = "#a90000", #Burger menu hover color [Parameter()] [string]$MenuCrossColor = "#bdc3c7", #Cross to close the menu color [Parameter()] [string]$MenuInnerColor = "#3F51B5", #Inner menu background color [Parameter()] [string]$MenuOuterColor = "#1B224B", #Outer menu background color [Parameter()] [string]$MorphShapeFill = "#373a47", [Parameter()] [ValidateSet("fixed", "absolute")]$BurgerPosition = "absolute", #To scroll with the page or not [Parameter()] [string]$BurgerTop = "16px", #Top margin for burger menu [Parameter()] [string]$BurgerWidth = "36px", #Sets width of the burger menu [Parameter()] [string]$BurgerHeight = "30px", #Sets height of the burger menu [Parameter()] [string]$BurgerLeft = "36px", #Determines how far left of the page to display burger menu [Parameter()] [string]$Padding = "0px 50px 0px 50px", #Padding for the main content of the page [Parameter()] [string]$MenuMarginLeft = "-50px", #Allows you to set the left margin of the menu [Parameter()] [string]$MenuMarginRight, #Allows you to set the margin right of the menu [Parameter()] [string]$MenuMarginBottom = "-20px", #Prevents little gap at the bottom of the page [Parameter()] [string]$MenuWidth, #This is defaulted to 300px [Parameter()] [decimal]$BurgerOpacity = 1 #Visibility of the button 0 sets it to invisible ) End { @{ # The AssetID of the main JS File assetId = $AssetId # Tell UD this is a plugin isPlugin = $true # This ID must be the same as the one used in the JavaScript to register the control with UD type = "UD-Burger" # An ID is mandatory id = $Id # This is where you can put any other properties. They are passed to the React control's props # The keys are case-sensitive in JS. tag = $Effect links = $Links.Invoke() content = $Content.Invoke() right = $Right.IsPresent burgerMarginLeft = $BurgerMarginLeft burgerBackground = $BurgerBackgroundColor burgerHover = $BurgerHoverColor crossColor = $MenuCrossColor menuInnerColor = $MenuInnerColor menuOuterColor = $MenuOuterColor morphShapeFill = $MorphShapeFill burgerPosition = $BurgerPosition burgerTop = $BurgerTop burgerWidth = $BurgerWidth burgerHeight = $BurgerHeight burgerLeft = $BurgerLeft padding = $Padding menuMarginLeft = $MenuMarginLeft menuMarginRight = $MenuMarginRight menuMarginBottom = $MenuMarginBottom menuWidth = $MenuWidth burgerOpacity = $BurgerOpacity } } } |