-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1431 from Shopify/ml/progressindicator
Add ProgressIndicator component
- Loading branch information
Showing
10 changed files
with
129 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@shopify/ui-extensions': patch | ||
'@shopify/ui-extensions-react': patch | ||
--- | ||
|
||
Add ProgressIndicator to admin |
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
9 changes: 9 additions & 0 deletions
9
.../ui-extensions-react/src/surfaces/admin/components/ProgressIndicator/ProgressIndicator.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,9 @@ | ||
import {ProgressIndicator as BaseProgressIndicator} from '@shopify/ui-extensions/admin'; | ||
import type {ProgressIndicatorProps} from '@shopify/ui-extensions/admin'; | ||
import {createRemoteReactComponent} from '@remote-ui/react'; | ||
|
||
export const ProgressIndicator = createRemoteReactComponent< | ||
'ProgressIndicator', | ||
ProgressIndicatorProps | ||
>(BaseProgressIndicator); | ||
export type {ProgressIndicatorProps} from '@shopify/ui-extensions/admin'; |
12 changes: 12 additions & 0 deletions
12
.../surfaces/admin/components/ProgressIndicator/examples/basic-ProgressIndicator.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,12 @@ | ||
import { | ||
reactExtension, | ||
ProgressIndicator, | ||
} from '@shopify/ui-extensions-react/admin'; | ||
|
||
reactExtension('Playground', () => <App />); | ||
|
||
function App() { | ||
return ( | ||
<ProgressIndicator size="small-200" /> | ||
); | ||
} |
Binary file added
BIN
+3.47 KB
...ges/ui-extensions/docs/surfaces/admin/screenshots/progressindicator-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
+5.74 KB
...s/ui-extensions/docs/surfaces/admin/screenshots/progressindicator-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
48 changes: 48 additions & 0 deletions
48
...es/ui-extensions/src/surfaces/admin/components/ProgressIndicator/ProgressIndicator.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,48 @@ | ||
import {ReferenceEntityTemplateSchema} from '@shopify/generate-docs'; | ||
|
||
const data: ReferenceEntityTemplateSchema = { | ||
name: 'ProgressIndicator', | ||
description: | ||
'Use this component to notify merchants that their action is being processed or loaded.', | ||
requires: '', | ||
thumbnail: 'progressindicator-thumbnail.png', | ||
isVisualComponent: true, | ||
type: '', | ||
definitions: [ | ||
{ | ||
title: 'ProgressIndicatorProps', | ||
description: '', | ||
type: 'ProgressIndicatorProps', | ||
}, | ||
], | ||
category: 'Components', | ||
subCategory: 'Media', | ||
defaultExample: { | ||
image: 'progressindicator-default.png', | ||
codeblock: { | ||
title: 'Simple spinner example', | ||
tabs: [ | ||
{ | ||
title: 'React', | ||
code: '../../../../../../ui-extensions-react/src/surfaces/admin/components/ProgressIndicator/examples/basic-ProgressIndicator.example.tsx', | ||
language: 'tsx', | ||
}, | ||
{ | ||
title: 'JS', | ||
code: './examples/basic-ProgressIndicator.example.ts', | ||
language: 'js', | ||
}, | ||
], | ||
}, | ||
}, | ||
|
||
related: [ | ||
{ | ||
type: 'component', | ||
name: 'Button', | ||
url: '/docs/api/admin-extensions/components/actions/button', | ||
}, | ||
], | ||
}; | ||
|
||
export default data; |
32 changes: 32 additions & 0 deletions
32
packages/ui-extensions/src/surfaces/admin/components/ProgressIndicator/ProgressIndicator.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,32 @@ | ||
import {createRemoteComponent} from '@remote-ui/core'; | ||
import {GlobalProps, SizeScale, AccessibilityLabelProps} from '../shared'; | ||
|
||
export interface ProgressIndicatorProps | ||
extends GlobalProps, | ||
AccessibilityLabelProps { | ||
/** | ||
* The size of the component. | ||
*/ | ||
size: SizeScale; | ||
|
||
/** | ||
* Set the color of the progress indicator. | ||
* | ||
* - `inherit` will take the color value from its parent, | ||
* giving the progress indicator a monochrome appearance. | ||
* | ||
* @defaultValue 'default' | ||
*/ | ||
tone?: 'inherit' | 'default'; | ||
|
||
/** | ||
* Style of the progress indicator | ||
* @default 'spinner' | ||
*/ | ||
variant?: 'spinner'; | ||
} | ||
|
||
export const ProgressIndicator = createRemoteComponent< | ||
'ProgressIndicator', | ||
ProgressIndicatorProps | ||
>('ProgressIndicator'); |
18 changes: 18 additions & 0 deletions
18
...c/surfaces/admin/components/ProgressIndicator/examples/basic-ProgressIndicator.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,18 @@ | ||
import { | ||
extension, | ||
ProgressIndicator, | ||
} from '@shopify/ui-extensions/admin'; | ||
|
||
export default extension( | ||
'Playground', | ||
(root) => { | ||
const progressIndicator = root.createComponent( | ||
ProgressIndicator, | ||
{ | ||
size: 'small-200', | ||
}, | ||
); | ||
|
||
root.appendChild(progressIndicator); | ||
}, | ||
); |