Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ProgressIndicator component #1431

Merged
merged 1 commit into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
MitchLillie marked this conversation as resolved.
Show resolved Hide resolved
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);
},
);
Loading