-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add Heading and HeadingGroup components to admin surface
- Loading branch information
1 parent
d25414a
commit b141737
Showing
8 changed files
with
63 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
5 changes: 5 additions & 0 deletions
5
packages/ui-extensions-react/src/surfaces/admin/components/Heading/Heading.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,5 @@ | ||
import {Heading as BaseHeading} from '@shopify/ui-extensions/admin'; | ||
import {createRemoteReactComponent} from '@remote-ui/react'; | ||
|
||
export const Heading = createRemoteReactComponent(BaseHeading); | ||
export type {HeadingProps} from '@shopify/ui-extensions/admin'; |
5 changes: 5 additions & 0 deletions
5
packages/ui-extensions-react/src/surfaces/admin/components/HeadingGroup/HeadingGroup.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,5 @@ | ||
import {HeadingGroup as BaseHeadingGroup} from '@shopify/ui-extensions/admin'; | ||
import {createRemoteReactComponent} from '@remote-ui/react'; | ||
|
||
export const HeadingGroup = createRemoteReactComponent(BaseHeadingGroup); | ||
export type {HeadingGroupProps} from '@shopify/ui-extensions/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
23 changes: 23 additions & 0 deletions
23
packages/ui-extensions/src/surfaces/admin/components/Heading/Heading.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,23 @@ | ||
import {createRemoteComponent} from '@remote-ui/core'; | ||
import type {AccessibilityRole} from '../shared'; | ||
|
||
type Level = 1 | 2 | 3 | 4 | 5 | 6; | ||
|
||
export interface HeadingProps { | ||
/** A unique identifier for the field. */ | ||
id?: string; | ||
|
||
/** The visual level of the heading. */ | ||
level?: Level; | ||
|
||
/** | ||
* Sets the semantic meaning of the component’s content. When set, | ||
* the role will be used by assistive technologies to help buyers | ||
* navigate the page. | ||
*/ | ||
accessibilityRole?: Extract<AccessibilityRole, 'presentation'>; | ||
} | ||
|
||
export const Heading = createRemoteComponent<'Heading', HeadingProps>( | ||
'Heading', | ||
); |
9 changes: 9 additions & 0 deletions
9
packages/ui-extensions/src/surfaces/admin/components/Heading/README.md
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 @@ | ||
# Heading | ||
|
||
Headings communicate the organization of the content on the page. | ||
|
||
## Note | ||
|
||
:exclamation: The `level` affects the visual level, but not the actual semantic heading HTML element (`<h1>`,`<h2>`, etc) that gets rendered by the browser. :exclamation: | ||
|
||
The specific heading element that gets rendered will be dynamically determined by the `HeadingGroup` component. |
8 changes: 8 additions & 0 deletions
8
packages/ui-extensions/src/surfaces/admin/components/HeadingGroup/HeadingGroup.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,8 @@ | ||
import {createRemoteComponent} from '@remote-ui/core'; | ||
|
||
export interface HeadingGroupProps {} | ||
|
||
export const HeadingGroup = createRemoteComponent< | ||
'HeadingGroup', | ||
HeadingGroupProps | ||
>('HeadingGroup'); |
5 changes: 5 additions & 0 deletions
5
packages/ui-extensions/src/surfaces/admin/components/HeadingGroup/README.md
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,5 @@ | ||
# HeadingGroup | ||
|
||
Heading group controls the heading level of headings nested within it, like H1, H2, H3. | ||
|
||
Use a heading group whenever you use a heading to ensure the experience is the same for screen reader users. When using a heading, any children related to that heading should be nested within the same heading group. |