Skip to content

Commit

Permalink
Use new Scope default parameter in docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dphfox committed Aug 19, 2024
1 parent 253c9ca commit 9849f07
Show file tree
Hide file tree
Showing 9 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions docs/examples/cookbook/button-component.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ local ROUNDED_CORNERS = UDim.new(0, 4)
local PADDING = UDim2.fromOffset(6, 4)

local function Button(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Name: UsedAs<string>?,
Layout: {
Expand Down Expand Up @@ -139,7 +139,7 @@ readable documentation.

```Lua
local function Button(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Name: UsedAs<string>?,
Layout: {
Expand Down
8 changes: 4 additions & 4 deletions docs/examples/cookbook/drag-and-drop.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ type DragInfo = {
}

local function Draggable(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
ID: string,
Name: UsedAs<string>?,
Expand Down Expand Up @@ -157,7 +157,7 @@ local function getTodoItemForID(
end

local function TodoEntry(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Item: TodoItem,
Parent: UsedAs<Instance?>,
Expand Down Expand Up @@ -370,7 +370,7 @@ type DragInfo = {
}

local function Draggable(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
ID: string,
Name: UsedAs<string>?,
Expand Down Expand Up @@ -486,7 +486,7 @@ The `TodoEntry` component is meant to represent one individual `TodoItem`.

```Lua
local function TodoEntry(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Item: TodoItem,
Parent: UsedAs<Instance?>,
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/cookbook/loading-spinner.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ local SPIN_DEGREES_PER_SECOND = 180
local SPIN_SIZE = 50

local function Spinner(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Layout: {
LayoutOrder: UsedAs<number>?,
Expand Down Expand Up @@ -80,7 +80,7 @@ The main thing to note is that it asks for a `CurrentTime` property.

```Lua hl_lines="10"
local function Spinner(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Layout: {
LayoutOrder: UsedAs<number>?,
Expand Down
4 changes: 2 additions & 2 deletions docs/examples/cookbook/player-list.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ local Children = Fusion.Children
type UsedAs<T> = Fusion.UsedAs<T>

local function PlayerList(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Players: UsedAs<{Player}>
}
Expand Down Expand Up @@ -97,7 +97,7 @@ position, size, appearance and behaviour.

```Lua
local function PlayerList(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Players: UsedAs<{Player}>
}
Expand Down
6 changes: 3 additions & 3 deletions docs/tutorials/best-practices/callbacks.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ the button is clicked, the button needs to run some external code:

```Lua hl_lines="17"
local function Button(
scope: Fusion.Scope<typeof(Fusion)>
scope: Fusion.Scope,
props: {
Position: UsedAs<UDim2>?,
Size: UsedAs<UDim2>?,
Expand Down Expand Up @@ -102,7 +102,7 @@ Luau won't add the key to the table if the value is `nil`.

```Lua hl_lines="7 18"
local function Button(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Position: UsedAs<UDim2>?,
Size: UsedAs<UDim2>?,
Expand All @@ -128,7 +128,7 @@ to do your own processing first:

```Lua hl_lines="19-23"
local function Button(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Position: UsedAs<UDim2>?,
Size: UsedAs<UDim2>?,
Expand Down
12 changes: 6 additions & 6 deletions docs/tutorials/best-practices/components.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ For example, consider this function, which generates a button based on some
type UsedAs<T> = Fusion.UsedAs<T>

local function Button(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Position: UsedAs<UDim2>?,
AnchorPoint: UsedAs<Vector2>?,
Expand Down Expand Up @@ -174,7 +174,7 @@ scope with those methods pre-defined.

```Lua hl_lines="2"
local function Component(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {}
)
return scope:New "Thing" {
Expand All @@ -189,7 +189,7 @@ Instead, create a new inner scope with the methods you need.

```Lua hl_lines="5-8"
local function Component(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {}
)
local scope = scope:innerScope {
Expand Down Expand Up @@ -247,7 +247,7 @@ Here's an example of how you could split up some components into modules:
type UsedAs<T> = Fusion.UsedAs<T>

local function PopUp(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Message: UsedAs<string>,
DismissText: UsedAs<string>
Expand Down Expand Up @@ -282,7 +282,7 @@ Here's an example of how you could split up some components into modules:
type UsedAs<T> = Fusion.UsedAs<T>

local function Message(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Text: UsedAs<string>
}
Expand All @@ -307,7 +307,7 @@ Here's an example of how you could split up some components into modules:
type UsedAs<T> = Fusion.UsedAs<T>

local function Button(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
Text: UsedAs<string>
}
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/best-practices/instance-handling.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ example, if you accept a table of `props`, you can add a `[Children]` key:

```Lua hl_lines="4 8"
local function PopUp(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
[typeof(Children)]: Fusion.Children
}
Expand Down
2 changes: 1 addition & 1 deletion docs/tutorials/best-practices/sharing-values.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ codebase will be able to see and interact with those state objects.
}

function Theme.init(
scope: Fusion.Scope<typeof(Fusion)>
scope: Fusion.Scope
)
Theme.currentTheme = scope:Value("light")
end
Expand Down
8 changes: 4 additions & 4 deletions docs/tutorials/best-practices/state.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ local HOVER_COLOUR = Color3.new(0.5, 0.75, 1)
local REST_COLOUR = Color3.new(0.25, 0.5, 1)

local function Button(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
-- ... some properties ...
}
Expand Down Expand Up @@ -58,7 +58,7 @@ now there's two state objects where one would have sufficed

```Lua hl_lines="7"
local function CheckBox(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
-- ... some properties ...
}
Expand Down Expand Up @@ -86,7 +86,7 @@ intercept the click or toggle a different state

```Lua hl_lines="4"
local function CheckBox(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
IsChecked: Fusion.Value<boolean> -- slightly better
}
Expand All @@ -111,7 +111,7 @@ check box is completely customisable

```Lua hl_lines="4-5 10"
local function CheckBox(
scope: Fusion.Scope<typeof(Fusion)>,
scope: Fusion.Scope,
props: {
IsChecked: UsedAs<boolean>, -- best
OnClick: () -> ()
Expand Down

0 comments on commit 9849f07

Please sign in to comment.