local s=Roact.PureComponent:extend(script.Name)function s.init(s)s:UpdateHotkeyTextSize(s.props.HotkeyLabel)end function s.willUpdate(N,s)if N.props.HotkeyLabel~=s.HotkeyLabel then N:UpdateHotkeyTextSize(s.HotkeyLabel)end end function s.UpdateHotkeyTextSize(N,s)N.HotkeyTextSize=TextService:GetTextSize(s,9,Enum.Font.Gotham,Vector2.new(math.huge,math.huge))end function s.render(s)return new("\073\109\097\103\101\066\117\116\116\111\110",{BackgroundColor3=s.props.Tool.Color.Color,BackgroundTransparency=s.props.CurrentTool==s.props.Tool and 0 or 1;BorderSizePixel=0;Image=s.props.IconAssetId;AutoButtonColor=false;[Roact.Event.Activated]=function()s.props.Core.EquipTool(s.props.Tool)end},{Corners=new("\085\073\067\111\114\110\101\114",{CornerRadius=UDim.new(0,3)});Hotkey=new("\084\101\120\116\076\097\098\101\108",{BackgroundTransparency=1;Position=UDim2.new(0,3,0,3);Size=UDim2.fromOffset(s.HotkeyTextSize.X,s.HotkeyTextSize.Y);Font=Enum.Font.Gotham;Text=s.props.HotkeyLabel;TextColor3=Color3.fromRGB(255,255,255),TextSize=9;TextXAlignment=Enum.TextXAlignment.Left;TextYAlignment=Enum.TextYAlignment.Top})})end return s
-- Create component
local ToolButton = Roact.PureComponent:extend(script.Name)

function ToolButton:init()
	self:UpdateHotkeyTextSize(self.props.HotkeyLabel)
end

function ToolButton:willUpdate(nextProps)
	if self.props.HotkeyLabel ~= nextProps.HotkeyLabel then
		self:UpdateHotkeyTextSize(nextProps.HotkeyLabel)
	end
end

function ToolButton:UpdateHotkeyTextSize(Text)
	self.HotkeyTextSize = TextService:GetTextSize(Text, 9, Enum.Font.Gotham, Vector2.new(math.huge, math.huge))
end

function ToolButton:render()
	return new("ImageButton", {
		BackgroundColor3 = self.props.Tool.Color.Color,
		BackgroundTransparency = (self.props.CurrentTool == self.props.Tool) and 0 or 1,
		BorderSizePixel = 0,
		Image = self.props.IconAssetId,
		AutoButtonColor = false,
		[Roact.Event.Activated] = function()
			self.props.Core.EquipTool(self.props.Tool)
		end,
	}, {
		Corners = new("UICorner", {
			CornerRadius = UDim.new(0, 3),
		}),
		Hotkey = new("TextLabel", {
			BackgroundTransparency = 1,
			Position = UDim2.new(0, 3, 0, 3),
			Size = UDim2.fromOffset(self.HotkeyTextSize.X, self.HotkeyTextSize.Y),
			Font = Enum.Font.Gotham,
			Text = self.props.HotkeyLabel,
			TextColor3 = Color3.fromRGB(255, 255, 255),
			TextSize = 9,
			TextXAlignment = Enum.TextXAlignment.Left,
			TextYAlignment = Enum.TextYAlignment.Top,
		}),
	})
end

return ToolButton
