local n=require(script.Parent.Parent.Parent.Roact)local H=require(script.Parent.Parent)local w=n.Component:extend("\077\101\110\117\069\120\097\109\112\108\101\067\111\109\112\111\110\101\110\116")function w.init(n)n:setState({open=false})end function w.render(w)return n.createElement(H.ThemeProvider,{Theme=H.Themes.Dark},{Backing=n.createElement("\070\114\097\109\101",{Size=UDim2.fromScale(1,1);BackgroundColor3=Color3.new(1,1,1),BorderSizePixel=0},{ToggleButton=n.createElement(H.Button,{Text="\079\112\101\110 \077\101\110\117";Size=UDim2.fromOffset(200,40);Position=UDim2.fromScale(.5,.5);AnchorPoint=Vector2.new(.5,.5),OnClicked=function(n)w:setState({open=true})end},{Menu=n.createElement(H.Menu,{Width=UDim.new(0,200),Open=w.state.open;Options={"\084\101\115\116","\084\101\115\116 \050",H.Menu.Divider;"\084\101\115\116 \051"};ZIndex=2;OnOptionSelected=function(n)print(n)w:setState({open=false})end})})})})end return function(H)local q=n.mount(n.createElement(w),H)return function()n.unmount(q)end end
local Roact = require(script.Parent.Parent.Parent.Roact)
local RoactMaterial = require(script.Parent.Parent)

local ExampleComponent = Roact.Component:extend("MenuExampleComponent")

function ExampleComponent:init()
	self:setState({
		open = false,
	})
end

function ExampleComponent:render()
	return Roact.createElement(RoactMaterial.ThemeProvider, {
		Theme = RoactMaterial.Themes.Dark,
	}, {
		Backing = Roact.createElement("Frame", {
			Size = UDim2.fromScale(1, 1),
			BackgroundColor3 = Color3.new(1, 1, 1),
			BorderSizePixel = 0,
		}, {
			ToggleButton = Roact.createElement(RoactMaterial.Button, {
				Text = "Open Menu",
				Size = UDim2.fromOffset(200, 40),
				Position = UDim2.fromScale(0.5, 0.5),
				AnchorPoint = Vector2.new(0.5, 0.5),

				OnClicked = function(newValue)
					self:setState({
						open = true,
					})
				end,
			}, {
				Menu = Roact.createElement(RoactMaterial.Menu, {
					Width = UDim.new(0, 200),
					Open = self.state.open,
					Options = {
						"Test",
						"Test 2",
						RoactMaterial.Menu.Divider,
						"Test 3"
					},

					ZIndex = 2,
					OnOptionSelected = function(option)
						print(option)
						self:setState({
							open = false,
						})
					end,
				}),
			}),
		}),
	})
end

return function(Target)
	local Tree = Roact.mount(Roact.createElement(ExampleComponent), Target)
	return function()
		Roact.unmount(Tree)
	end
end