Skip to content

Commit

Permalink
Add ProgressIndicator component
Browse files Browse the repository at this point in the history
  • Loading branch information
MitchLillie committed Oct 13, 2023
1 parent 59c175a commit 8f82c57
Show file tree
Hide file tree
Showing 10 changed files with 129 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .changeset/blue-frogs-yell.md
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
2 changes: 2 additions & 0 deletions packages/ui-extensions-react/src/surfaces/admin/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ export {PasswordField} from './components/PasswordField/PasswordField';
export type {PasswordFieldProps} from './components/PasswordField/PasswordField';
export {Pressable} from './components/Pressable/Pressable';
export type {PressableProps} from './components/Pressable/Pressable';
export {ProgressIndicator} from './components/ProgressIndicator/ProgressIndicator';
export type {ProgressIndicatorProps} from './components/ProgressIndicator/ProgressIndicator';
export {ResourceItem} from './components/ResourceItem/ResourceItem';
export type {ResourceItemProps} from './components/ResourceItem/ResourceItem';
export {ResourceList} from './components/ResourceList/ResourceList';
Expand Down
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';
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" />
);
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions packages/ui-extensions/src/surfaces/admin/components.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ export {PasswordField} from './components/PasswordField/PasswordField';
export type {PasswordFieldProps} from './components/PasswordField/PasswordField';
export {Pressable} from './components/Pressable/Pressable';
export type {PressableProps} from './components/Pressable/Pressable';
export {ProgressIndicator} from './components/ProgressIndicator/ProgressIndicator';
export type {ProgressIndicatorProps} from './components/ProgressIndicator/ProgressIndicator';
export {ResourceItem} from './components/ResourceItem/ResourceItem';
export type {ResourceItemProps} from './components/ResourceItem/ResourceItem';
export {ResourceList} from './components/ResourceList/ResourceList';
Expand Down
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;
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');
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);
},
);

0 comments on commit 8f82c57

Please sign in to comment.