-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
164 additions
and
35 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
packages/ui-extensions/docs/surfaces/point-of-sale/reference/components/Box.doc.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,29 @@ | ||
import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'; | ||
import {generateCodeBlock} from '../helpers/generateCodeBlock'; | ||
|
||
const generateCodeBlockForBanner = (title: string, fileName: string) => | ||
generateCodeBlock(title, 'box', fileName); | ||
|
||
const data: ReferenceEntityTemplateSchema = { | ||
name: 'Box', | ||
description: | ||
'A box component is a container that can be used to group and display content in a consistent manner.', | ||
isVisualComponent: true, | ||
type: 'component', | ||
definitions: [ | ||
{ | ||
title: 'Box', | ||
description: '', | ||
type: 'BoxProps', | ||
}, | ||
], | ||
category: 'Components', | ||
related: [], | ||
thumbnail: 'box-thumbnail.png', | ||
defaultExample: { | ||
image: 'box-default.png', | ||
codeblock: generateCodeBlockForBanner('Box', 'default.example'), | ||
}, | ||
}; | ||
|
||
export default data; |
40 changes: 40 additions & 0 deletions
40
packages/ui-extensions/docs/surfaces/point-of-sale/reference/examples/box/default.example.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,40 @@ | ||
import { | ||
extend, | ||
Navigator, | ||
Screen, | ||
ScrollView, | ||
Box, | ||
Image, | ||
} from '@shopify/ui-extensions/point-of-sale'; | ||
|
||
export default extend('pos.home.modal.render', (root) => { | ||
const navigator = root.createComponent(Navigator); | ||
|
||
const imageBoxScreen = navigator.createComponent(Screen, { | ||
name: 'ImageBox', | ||
title: 'ImageBox', | ||
}); | ||
|
||
const scrollView = imageBoxScreen.createComponent(ScrollView); | ||
|
||
const box = scrollView.createComponent(Box, { | ||
blockSize: '100px', | ||
inlineSize: '100px', | ||
paddingInlineStart: '100px', | ||
paddingInlineEnd: '100px', | ||
paddingBlockStart: '100px', | ||
paddingBlockEnd: '100px', | ||
}); | ||
|
||
const image = box.createComponent(Image, { | ||
src: 'example.png', | ||
size: 'contain', | ||
}); | ||
|
||
box.appendChild(image); | ||
scrollView.appendChild(box); | ||
imageBoxScreen.appendChild(scrollView); | ||
navigator.appendChild(imageBoxScreen); | ||
|
||
root.appendChild(navigator); | ||
}); |
39 changes: 39 additions & 0 deletions
39
...ages/ui-extensions/docs/surfaces/point-of-sale/reference/examples/box/default.example.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,39 @@ | ||
import React from 'react'; | ||
|
||
import { | ||
Box, | ||
Image, | ||
Navigator, | ||
Screen, | ||
ScrollView, | ||
reactExtension, | ||
} from '@shopify/ui-extensions-react/point-of-sale'; | ||
|
||
const ImageModal = () => { | ||
return ( | ||
<Navigator> | ||
<Screen name="ImageBox" title="ImageBox"> | ||
<ScrollView> | ||
<Box | ||
blockSize={'100px'} | ||
inlineSize={'100px'} | ||
paddingInlineStart={'100'} | ||
paddingInlineEnd={'100'} | ||
paddingBlockEnd={'100'} | ||
paddingBlockStart={'100'} | ||
> | ||
<Image | ||
src="example.png" | ||
size="contain" | ||
/> | ||
</Box> | ||
</ScrollView> | ||
</Screen> | ||
</Navigator> | ||
); | ||
}; | ||
|
||
export default reactExtension( | ||
'pos.home.modal.render', | ||
() => <ImageModal />, | ||
); |
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
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
Binary file added
BIN
+7.46 KB
packages/ui-extensions/docs/surfaces/point-of-sale/screenshots/box-default.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+10.3 KB
packages/ui-extensions/docs/surfaces/point-of-sale/screenshots/box-thumbnail.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
3 changes: 3 additions & 0 deletions
3
packages/ui-extensions/src/surfaces/point-of-sale/render/components/shared/sizes.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 |
---|---|---|
@@ -1,3 +1,6 @@ | ||
/** | ||
* SizeKeyword maps to predetermined values in POS. | ||
*/ | ||
export type SizeKeyword = | ||
| '0' | ||
| '025' | ||
|