-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added TS example and made TSX examples consistent
- Loading branch information
Showing
20 changed files
with
514 additions
and
115 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
27 changes: 27 additions & 0 deletions
27
...ions/docs/surfaces/point-of-sale/reference/examples/stack/block-align-content-stretch.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import { | ||
reactExtension, | ||
SegmentedControl, | ||
Stack, | ||
Screen, | ||
} from '@shopify/ui-extensions-react/point-of-sale'; | ||
import React from 'react'; | ||
|
||
export default reactExtension('pos.home.modal.render', () => ( | ||
<Screen name="Stack" title="Stack"> | ||
<Stack direction="block" gap="400" alignContent="stretch" padding="400"> | ||
<SegmentedControl | ||
selected="1" | ||
segments={[ | ||
{id: '1', label: 'Segment 1', disabled: false}, | ||
{id: '2', label: 'Segment 2', disabled: false}, | ||
{id: '3', label: 'Segment 3', disabled: false}, | ||
{id: '4', label: 'Segment 4', disabled: false}, | ||
{id: '5', label: 'Segment 5', disabled: false}, | ||
{id: '6', label: 'Segment 6', disabled: false}, | ||
{id: '7', label: 'Segment 7', disabled: false}, | ||
]} | ||
onSelect={(id) => console.log(`Selected segment with id: ${id}`)} | ||
/> | ||
</Stack> | ||
</Screen> | ||
)); |
29 changes: 0 additions & 29 deletions
29
...ons/docs/surfaces/point-of-sale/reference/examples/stack/block-align-contents-stretch.tsx
This file was deleted.
Oops, something went wrong.
37 changes: 37 additions & 0 deletions
37
...es/ui-extensions/docs/surfaces/point-of-sale/reference/examples/stack/block-center-all.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { | ||
extension, | ||
Button, | ||
Screen, | ||
Stack, | ||
} from '@shopify/ui-extensions/point-of-sale'; | ||
|
||
export default extension('pos.home.modal.render', (root) => { | ||
const button1 = root.createComponent(Button, { | ||
title: 'Hello', | ||
}); | ||
|
||
const button2 = root.createComponent(Button, { | ||
title: 'Hello', | ||
}); | ||
|
||
const stack = root.createComponent(Stack, { | ||
direction: 'block', | ||
justifyContent: 'center', | ||
alignContent: 'center', | ||
alignItems: 'center', | ||
inlineSize: '100%', | ||
paddingInline: '450', | ||
blockSize: '50%', | ||
gap: '200', | ||
}); | ||
stack.append(button1, button2); | ||
|
||
const screen = root.createComponent(Screen, { | ||
name: 'Stack', | ||
title: 'Stack', | ||
}); | ||
screen.append(stack); | ||
root.append(screen); | ||
|
||
root.mount(); | ||
}); |
40 changes: 25 additions & 15 deletions
40
...s/ui-extensions/docs/surfaces/point-of-sale/reference/examples/stack/block-center-all.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,25 @@ | ||
<Screen name="Stack" title="Stack"> | ||
<Stack | ||
direction="block" | ||
justifyContent="center" | ||
alignContent="center" | ||
alignItems="center" | ||
inlineSize="100%" | ||
paddingInline="450" | ||
blockSize="50%" | ||
gap="200" | ||
> | ||
<Button title="hello" /> | ||
<Button title="hello" /> | ||
</Stack> | ||
</Screen>; | ||
import { | ||
reactExtension, | ||
Button, | ||
Stack, | ||
Screen, | ||
} from '@shopify/ui-extensions-react/point-of-sale'; | ||
import React from 'react'; | ||
|
||
export default reactExtension('pos.home.modal.render', () => ( | ||
<Screen name="Stack" title="Stack"> | ||
<Stack | ||
direction="block" | ||
gap="200" | ||
justifyContent="center" | ||
alignContent="center" | ||
alignItems="center" | ||
inlineSize="100%" | ||
paddingInline="450" | ||
blockSize="50%" | ||
> | ||
<Button title="Hello" /> | ||
<Button title="Hello" /> | ||
</Stack> | ||
</Screen> | ||
)); |
38 changes: 38 additions & 0 deletions
38
...ui-extensions/docs/surfaces/point-of-sale/reference/examples/stack/block-space-between.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { | ||
extension, | ||
Button, | ||
Screen, | ||
Stack, | ||
} from '@shopify/ui-extensions/point-of-sale'; | ||
|
||
export default extension('pos.home.modal.render', (root) => { | ||
const button1 = root.createComponent(Button, { | ||
title: 'Hello', | ||
}); | ||
|
||
const button2 = root.createComponent(Button, { | ||
title: 'Hello', | ||
}); | ||
|
||
const button3 = root.createComponent(Button, { | ||
title: 'Hello', | ||
}); | ||
|
||
const stack = root.createComponent(Stack, { | ||
direction: 'block', | ||
gap: '200', | ||
justifyContent: 'space-between', | ||
blockSize: '50%', | ||
paddingInline: '450', | ||
}); | ||
stack.append(button1, button2, button3); | ||
|
||
const screen = root.createComponent(Screen, { | ||
name: 'Stack', | ||
title: 'Stack', | ||
}); | ||
screen.append(stack); | ||
root.append(screen); | ||
|
||
root.mount(); | ||
}); |
35 changes: 23 additions & 12 deletions
35
...i-extensions/docs/surfaces/point-of-sale/reference/examples/stack/block-space-between.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,23 @@ | ||
<Screen name="Stack" title="Stack"> | ||
<Stack | ||
direction="block" | ||
justifyContent="space-between" | ||
paddingInline="450" | ||
blockSize="50%" | ||
gap="200" | ||
> | ||
<Button title="hello" /> | ||
<Button title="hello" /> | ||
</Stack> | ||
</Screen>; | ||
import { | ||
reactExtension, | ||
Button, | ||
Stack, | ||
Screen, | ||
} from '@shopify/ui-extensions-react/point-of-sale'; | ||
import React from 'react'; | ||
|
||
export default reactExtension('pos.home.modal.render', () => ( | ||
<Screen name="Stack" title="Stack"> | ||
<Stack | ||
direction="block" | ||
gap="200" | ||
justifyContent="space-between" | ||
blockSize="50%" | ||
paddingInline="450" | ||
> | ||
<Button title="Hello" /> | ||
<Button title="Hello" /> | ||
<Button title="Hello" /> | ||
</Stack> | ||
</Screen> | ||
)); |
36 changes: 36 additions & 0 deletions
36
packages/ui-extensions/docs/surfaces/point-of-sale/reference/examples/stack/block.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { | ||
extension, | ||
Button, | ||
Screen, | ||
Stack, | ||
} from '@shopify/ui-extensions/point-of-sale'; | ||
|
||
export default extension('pos.home.modal.render', (root) => { | ||
const button1 = root.createComponent(Button, { | ||
title: 'Hello', | ||
}); | ||
|
||
const button2 = root.createComponent(Button, { | ||
title: 'Hello', | ||
}); | ||
|
||
const button3 = root.createComponent(Button, { | ||
title: 'Hello', | ||
}); | ||
|
||
const stack = root.createComponent(Stack, { | ||
direction: 'block', | ||
gap: '200', | ||
paddingInline: '450', | ||
}); | ||
stack.append(button1, button2, button3); | ||
|
||
const screen = root.createComponent(Screen, { | ||
name: 'Stack', | ||
title: 'Stack', | ||
}); | ||
screen.append(stack); | ||
root.append(screen); | ||
|
||
root.mount(); | ||
}); |
23 changes: 17 additions & 6 deletions
23
packages/ui-extensions/docs/surfaces/point-of-sale/reference/examples/stack/block.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,17 @@ | ||
<Screen name="Stack" title="Stack"> | ||
<Stack direction="block" paddingInline="450" gap="200"> | ||
<Button title="hello" /> | ||
<Button title="hello" /> | ||
</Stack> | ||
</Screen>; | ||
import { | ||
reactExtension, | ||
Button, | ||
Stack, | ||
Screen, | ||
} from '@shopify/ui-extensions-react/point-of-sale'; | ||
import React from 'react'; | ||
|
||
export default reactExtension('pos.home.modal.render', () => ( | ||
<Screen name="Stack" title="Stack"> | ||
<Stack direction="block" gap="200" paddingInline="450"> | ||
<Button title="Hello" /> | ||
<Button title="Hello" /> | ||
<Button title="Hello" /> | ||
</Stack> | ||
</Screen> | ||
)); |
47 changes: 47 additions & 0 deletions
47
...ensions/docs/surfaces/point-of-sale/reference/examples/stack/inline-align-items-center.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { | ||
extension, | ||
Button, | ||
Screen, | ||
Stack, | ||
ScrollView, | ||
} from '@shopify/ui-extensions/point-of-sale'; | ||
|
||
export default extension('pos.home.modal.render', (root) => { | ||
const button1 = root.createComponent(Button, { | ||
title: 'Hello', | ||
}); | ||
|
||
const button2 = root.createComponent(Button, { | ||
title: 'Hello', | ||
}); | ||
|
||
const button3 = root.createComponent(Button, { | ||
title: 'Hello', | ||
}); | ||
|
||
const innerStack = root.createComponent(Stack, { | ||
direction: 'block', | ||
gap: '200', | ||
}); | ||
innerStack.append(button1, button2); | ||
|
||
const mainStack = root.createComponent(Stack, { | ||
direction: 'inline', | ||
gap: '200', | ||
alignItems: 'center', | ||
alignContent: 'center', | ||
}); | ||
mainStack.append(innerStack, button3); | ||
|
||
const scrollView = root.createComponent(ScrollView); | ||
scrollView.append(mainStack); | ||
|
||
const screen = root.createComponent(Screen, { | ||
name: 'Stack', | ||
title: 'Stack', | ||
}); | ||
screen.append(scrollView); | ||
root.append(screen); | ||
|
||
root.mount(); | ||
}); |
41 changes: 26 additions & 15 deletions
41
...nsions/docs/surfaces/point-of-sale/reference/examples/stack/inline-align-items-center.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,27 @@ | ||
<Screen name="Stack" title="Stack"> | ||
<ScrollView> | ||
<Stack | ||
direction="inline" | ||
alignItems="center" | ||
alignContent="center" | ||
gap="200" | ||
> | ||
<Stack direction="block" gap="200"> | ||
<Button title="hello" /> | ||
<Button title="hello" /> | ||
import { | ||
reactExtension, | ||
Button, | ||
Stack, | ||
Screen, | ||
ScrollView, | ||
} from '@shopify/ui-extensions-react/point-of-sale'; | ||
import React from 'react'; | ||
|
||
export default reactExtension('pos.home.modal.render', () => ( | ||
<Screen name="Stack" title="Stack"> | ||
<ScrollView> | ||
<Stack | ||
direction="inline" | ||
gap="200" | ||
alignItems="center" | ||
alignContent="center" | ||
> | ||
<Stack direction="block" gap="200"> | ||
<Button title="Hello" /> | ||
<Button title="Hello" /> | ||
</Stack> | ||
<Button title="Hello" /> | ||
</Stack> | ||
<Button title="hello" /> | ||
</Stack> | ||
</ScrollView> | ||
</Screen>; | ||
</ScrollView> | ||
</Screen> | ||
)); |
Oops, something went wrong.