Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into modals
Browse files Browse the repository at this point in the history
  • Loading branch information
vocksel committed Aug 11, 2024
2 parents ff2be27 + 3384737 commit add6fa8
Show file tree
Hide file tree
Showing 20 changed files with 202 additions and 92 deletions.
1 change: 0 additions & 1 deletion .gitattributes

This file was deleted.

14 changes: 7 additions & 7 deletions foreman.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[tools]
rojo = { source = "rojo-rbx/rojo", version = "7.2.1" }
darklua = { source = "seaofvoices/darklua", version = "0.12.1" }
lune = { source = "lune-org/lune", version = "0.8.3" }
rojo = { source = "rojo-rbx/rojo", version = "7.4.3" }
darklua = { source = "seaofvoices/darklua", version = "0.13.1" }
lune = { source = "lune-org/lune", version = "0.8.7" }
run-in-roblox = { source = "rojo-rbx/run-in-roblox", version = "0.3.0" }
selene = { source = "kampfkarren/selene", version = "0.25.0" }
stylua = { source = "JohnnyMorganz/StyLua", version = "0.17.1" }
selene = { source = "Kampfkarren/selene", version = "0.27.1" }
stylua = { source = "JohnnyMorganz/StyLua", version = "0.20.0" }
tarmac = { source = "Roblox/tarmac", version = "0.7.0" }
wally = { source = "UpliftGames/wally", version = "0.3.2" }
luau-lsp = { source = "JohnnyMorganz/luau-lsp", version = "1.x" }
wally-package-types = { source = "JohnnyMorganz/wally-package-types", version = "1.2.1" }
luau-lsp = { source = "JohnnyMorganz/luau-lsp", version = "1.32.3" }
wally-package-types = { source = "JohnnyMorganz/wally-package-types", version = "1.3.2" }
11 changes: 9 additions & 2 deletions src/Common/Branding.story.luau
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
local Branding = require("./Branding")
local React = require("@pkg/React")

local Branding = require("./Branding")
local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")

return {
summary = "Icon and Typography for flipbook",
controls = {},
story = React.createElement(Branding),
story = React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
Branding = React.createElement(Branding),
}),
}
15 changes: 11 additions & 4 deletions src/Common/ScrollingFrame.story.luau
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
local React = require("@pkg/React")

local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")
local ScrollingFrame = require("./ScrollingFrame")

local controls = {
Expand Down Expand Up @@ -30,11 +33,15 @@ return {
})
end

return React.createElement("Frame", {
Size = UDim2.new(1, 0, 0, 200),
BackgroundTransparency = 1,
return React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
ScrollingFrame = React.createElement(ScrollingFrame, {}, children),
Wrapper = React.createElement("Frame", {
Size = UDim2.new(1, 0, 0, 200),
BackgroundTransparency = 1,
}, {
ScrollingFrame = React.createElement(ScrollingFrame, {}, children),
}),
})
end,
}
17 changes: 12 additions & 5 deletions src/Explorer/Component.story.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
local Component = require("./Component")
local React = require("@pkg/React")

local Component = require("./Component")
local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")

local childNode1 = {
name = "Button",
icon = "story",
Expand Down Expand Up @@ -37,9 +40,13 @@ local storybookNode = {
return {
summary = "Component as storybook with children",
controls = {},
story = React.createElement(Component, {
activeNode = nil,
node = storybookNode,
onClick = function() end,
story = React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
Component = React.createElement(Component, {
activeNode = nil,
node = storybookNode,
onClick = function() end,
}),
}),
}
17 changes: 11 additions & 6 deletions src/Forms/Button.story.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
local Button = require("./Button")
local React = require("@pkg/React")

local Button = require("./Button")
local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")

local controls = {
text = "Click me",
}
Expand All @@ -13,11 +16,13 @@ return {
summary = "A generic button component that can be used anywhere",
controls = controls,
story = function(props: Props)
return React.createElement(Button, {
text = props.controls.text,
onClick = function()
print("click")
end,
return React.createElement(ContextProviders, { plugin = MockPlugin.new() }, {
Button = React.createElement(Button, {
text = props.controls.text,
onClick = function()
print("click")
end,
}),
})
end,
}
19 changes: 13 additions & 6 deletions src/Forms/Checkbox.story.luau
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
local Checkbox = require("./Checkbox")
local React = require("@pkg/React")

local Checkbox = require("./Checkbox")
local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")

return {
summary = "Generic checkbox used for story controls",
story = React.createElement(Checkbox, {
initialState = true,
onStateChange = function(newState)
print("Checkbox state changed to", newState)
end,
story = React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
Checkbox = React.createElement(Checkbox, {
initialState = true,
onStateChange = function(newState)
print("Checkbox state changed to", newState)
end,
}),
}),
}
23 changes: 15 additions & 8 deletions src/Forms/Dropdown.story.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
local Dropdown = require("@root/Forms/Dropdown")
local React = require("@pkg/React")

local ContextProviders = require("@root/Common/ContextProviders")
local Dropdown = require("@root/Forms/Dropdown")
local MockPlugin = require("@root/Testing/MockPlugin")

local controls = {
useDefault = true,
numOptions = 3,
Expand All @@ -18,13 +21,17 @@ return {
table.insert(options, "Option " .. i)
end

return React.createElement(Dropdown, {
placeholder = "Select an option",
default = if props.controls.useDefault then options[1] else nil,
options = options,
onOptionChange = function(option)
print("Selected", option)
end,
return React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
Dropdown = React.createElement(Dropdown, {
placeholder = "Select an option",
default = if props.controls.useDefault then options[1] else nil,
options = options,
onOptionChange = function(option)
print("Selected", option)
end,
}),
})
end,
}
2 changes: 1 addition & 1 deletion src/Forms/InputField.luau
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ local function InputField(providedProps: Props)
if props.validate then
setIsValid(props.validate(newText))
end
end, {})
end, { text, props.transform, props.validate, props.onTextChange })

React.useEffect(function()
if props.autoFocus then
Expand Down
33 changes: 20 additions & 13 deletions src/Forms/InputField.story.luau
Original file line number Diff line number Diff line change
@@ -1,18 +1,25 @@
local InputField = require("./InputField")
local React = require("@pkg/React")

local ContextProviders = require("@root/Common/ContextProviders")
local InputField = require("./InputField")
local MockPlugin = require("@root/Testing/MockPlugin")

return {
story = React.createElement(InputField, {
placeholder = "Enter information...",
autoFocus = true,
onSubmit = function(text)
print(text)
end,
validate = function(text: string)
return #text <= 4
end,
transform = function(text: string)
return text:upper()
end,
story = React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
InputField = React.createElement(InputField, {
placeholder = "Enter information...",
autoFocus = true,
onSubmit = function(text)
print(text)
end,
validate = function(text: string)
return #text <= 4
end,
transform = function(text: string)
return text:upper()
end,
}),
}),
}
9 changes: 8 additions & 1 deletion src/Forms/Searchbar.story.luau
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
local React = require("@pkg/React")

local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")
local Searchbar = require("./Searchbar")

return {
summary = "Searchbar used to search for components",
controls = {},
story = React.createElement(Searchbar),
story = React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
Searchbar = React.createElement(Searchbar),
}),
}
11 changes: 9 additions & 2 deletions src/Forms/SelectableTextLabel.story.luau
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
local React = require("@pkg/React")

local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")
local SelectableTextLabel = require("./SelectableTextLabel")

local controls = {
Expand All @@ -13,8 +16,12 @@ return {
summary = "A styled TextLabel with selectable text. Click and drag with the mouse to select content",
controls = controls,
story = function(props: Props)
return React.createElement(SelectableTextLabel, {
Text = props.controls.text,
return React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
SelectableTextLabel = React.createElement(SelectableTextLabel, {
Text = props.controls.text,
}),
})
end,
}
27 changes: 17 additions & 10 deletions src/Panels/Sidebar.story.luau
Original file line number Diff line number Diff line change
@@ -1,19 +1,26 @@
local React = require("@pkg/React")

local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")
local Sidebar = require("./Sidebar")
local internalStorybook = require("@root/init.storybook.luau")

return {
summary = "Sidebar containing brand, searchbar, and component tree",
controls = {},
story = React.createElement(Sidebar, {
storybooks = {
internalStorybook,
},
selectStory = function(storyModule)
print(storyModule)
end,
selectStorybook = function(storybook)
print(storybook)
end,
story = React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
Sidebar = React.createElement(Sidebar, {
storybooks = {
internalStorybook,
},
selectStory = function(storyModule)
print(storyModule)
end,
selectStorybook = function(storybook)
print(storybook)
end,
}),
}),
}
15 changes: 11 additions & 4 deletions src/Plugin/PluginApp.story.luau
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
local ModuleLoader = require("@pkg/ModuleLoader")
local PluginApp = require("./PluginApp")
local React = require("@pkg/React")

local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")
local PluginApp = require("./PluginApp")

return {
summary = "The main component that handles the entire plugin",
controls = {},
story = React.createElement(PluginApp, {
loader = ModuleLoader.new(),
plugin = plugin,
story = React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
PluginApp = React.createElement(PluginApp, {
loader = ModuleLoader.new(),
plugin = plugin,
}),
}),
}
11 changes: 9 additions & 2 deletions src/Storybook/NoStorySelected.story.luau
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
local NoStorySelected = require("./NoStorySelected")
local React = require("@pkg/React")

local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")
local NoStorySelected = require("./NoStorySelected")

return {
story = React.createElement(NoStorySelected),
story = React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
NoStorySelected = React.createElement(NoStorySelected),
}),
}
33 changes: 21 additions & 12 deletions src/Storybook/StoryControls.story.luau
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@
local React = require("@pkg/React")

local ContextProviders = require("@root/Common/ContextProviders")
local MockPlugin = require("@root/Testing/MockPlugin")
local StoryControls = require("@root/Storybook/StoryControls")

return {
summary = "Panel for configuring the controls of a story",
story = React.createElement(StoryControls, {
controls = {
foo = "bar",
checkbox = false,
dropdown = {
"Option 1",
"Option 2",
"Option 3",
},
},
setControl = function() end,
}),
story = function()
return React.createElement(ContextProviders, {
plugin = MockPlugin.new(),
}, {
StoryControls = React.createElement(StoryControls, {
controls = {
foo = "bar",
checkbox = false,
dropdown = {
"Option 1",
"Option 2",
"Option 3",
},
},
setControl = function() end,
}),
})
end,
}
Loading

0 comments on commit add6fa8

Please sign in to comment.