-
Notifications
You must be signed in to change notification settings - Fork 5
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 #706 from WestpacGEL/develop
Develop
- Loading branch information
Showing
49 changed files
with
245 additions
and
106 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
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
63 changes: 63 additions & 0 deletions
63
...omponents/component-blocks/components/accessibility-demo/accessibility-demo.component.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,63 @@ | ||
'use client'; | ||
|
||
import { DocumentRenderer } from '@keystatic/core/renderer'; | ||
import { Select } from '@westpac/ui'; | ||
import { useId, useState } from 'react'; | ||
|
||
import { DOCUMENT_RENDERERS } from '@/app/articles/[article]/components/document-renderer'; | ||
import { Code } from '@/components/code'; | ||
import { VisionFilter, VisionFilterProps } from '@/components/vision-filter'; | ||
|
||
import { type AccessibilityDemoProps } from './accessibility-demo.types'; | ||
|
||
const FILTERS = [ | ||
{ text: 'No filter', value: '' }, | ||
{ text: 'Achromatomaly', value: 'achromatomaly' }, | ||
{ text: 'Achromatopsia', value: 'achromatopsia' }, | ||
{ text: 'Deuteranomaly', value: 'deuteranomaly' }, | ||
{ text: 'Deuteranopia', value: 'deuteranopia' }, | ||
{ text: 'Protanomaly', value: 'protanomaly' }, | ||
{ text: 'Protanopia', value: 'protanopia' }, | ||
{ text: 'Tritanomaly', value: 'tritanomaly' }, | ||
{ text: 'Tritanopia', value: 'tritanopia' }, | ||
{ text: 'Low contrast', value: 'low-contrast' }, | ||
] as const; | ||
|
||
export const AccessibilityDemo = ({ content }: AccessibilityDemoProps) => { | ||
const [filter, setFilter] = useState<VisionFilterProps['value']>(); | ||
const id = useId(); | ||
|
||
return ( | ||
<> | ||
<div className="flex items-center bg-light p-4"> | ||
<label htmlFor={id} className="mr-[1rem] whitespace-nowrap"> | ||
Select filter | ||
</label> | ||
<Select | ||
id={id} | ||
value={filter} | ||
width={10} | ||
onChange={(event: any) => setFilter(event.target.value as VisionFilterProps['value'])} | ||
> | ||
{FILTERS.map(filter => ( | ||
<option key={filter.text} value={filter.value}> | ||
{filter.text} | ||
</option> | ||
))} | ||
</Select> | ||
</div> | ||
<VisionFilter value={filter}> | ||
<DocumentRenderer | ||
document={content} | ||
renderers={{ | ||
...DOCUMENT_RENDERERS, | ||
block: { | ||
...DOCUMENT_RENDERERS.block, | ||
code: props => <Code {...props} live showCode={false} className="my-4" enableLiveCode={false} />, | ||
}, | ||
}} | ||
/> | ||
</VisionFilter> | ||
</> | ||
); | ||
}; |
24 changes: 24 additions & 0 deletions
24
.../components/component-blocks/components/accessibility-demo/accessibility-demo.preview.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,24 @@ | ||
import { component, fields } from '@keystatic/core'; | ||
|
||
import { AccessibilityDemo } from '.'; | ||
|
||
// Apparently the document field is not possible be implemented on a component. | ||
export const accessibilityDemo = component({ | ||
label: 'Accessibility Demo', | ||
preview: ({ fields }) => { | ||
return <h1>Accessibility Demo</h1>; | ||
// return <AccessibilityDemo content={content.value} />; | ||
}, | ||
schema: { | ||
// content: fields.document({ | ||
// label: 'Content', | ||
// componentBlocks: {}, | ||
// formatting: { | ||
// blockTypes: { | ||
// blockquote: true, | ||
// code: true, | ||
// }, | ||
// }, | ||
// }), | ||
}, | ||
}); |
5 changes: 5 additions & 0 deletions
5
...src/components/component-blocks/components/accessibility-demo/accessibility-demo.types.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 { DocumentElement } from '@keystatic/core'; | ||
|
||
export type AccessibilityDemoProps = { | ||
content: DocumentElement[]; | ||
}; |
2 changes: 2 additions & 0 deletions
2
apps/site/src/components/component-blocks/components/accessibility-demo/index.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,2 @@ | ||
export * from './accessibility-demo.component'; | ||
export * from './accessibility-demo.types'; |
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
3 changes: 3 additions & 0 deletions
3
...gn-system/components/accordion/accessibility/colour-impairment-demonstration/content.mdoc
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,3 @@ | ||
{% shortCode name="accessibility-colour-impairment" /%} | ||
|
||
{% accessibilityDemo /%} |
3 changes: 3 additions & 0 deletions
3
...design-system/components/alert/accessibility/colour-impairment-demonstration/content.mdoc
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,3 @@ | ||
{% shortCode name="accessibility-colour-impairment" /%} | ||
|
||
{% accessibilityDemo /%} |
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
...design-system/components/badge/accessibility/colour-impairment-demonstration/content.mdoc
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,3 @@ | ||
{% shortCode name="accessibility-colour-impairment" /%} | ||
|
||
{% accessibilityDemo /%} |
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
...esign-system/components/button/accessibility/colour-impairment-demonstration/content.mdoc
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,3 @@ | ||
{% shortCode name="accessibility-colour-impairment" /%} | ||
|
||
{% accessibilityDemo /%} |
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
...ign-system/components/compacta/accessibility/colour-impairment-demonstration/content.mdoc
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,3 @@ | ||
{% shortCode name="accessibility-colour-impairment" /%} | ||
|
||
{% accessibilityDemo /%} |
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
...-system/components/date-picker/accessibility/colour-impairment-demonstration/content.mdoc
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,3 @@ | ||
{% shortCode name="accessibility-colour-impairment" /%} | ||
|
||
{% accessibilityDemo /%} |
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
...-system/components/input-group/accessibility/colour-impairment-demonstration/content.mdoc
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,3 @@ | ||
{% shortCode name="accessibility-colour-impairment" /%} | ||
|
||
{% accessibilityDemo /%} |
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
.../design-system/components/link/accessibility/colour-impairment-demonstration/content.mdoc
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,3 @@ | ||
{% shortCode name="accessibility-colour-impairment" /%} | ||
|
||
{% accessibilityDemo /%} |
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
.../components/progress-indicator/accessibility/colour-impairment-demonstration/content.mdoc
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,3 @@ | ||
{% shortCode name="accessibility-colour-impairment" /%} | ||
|
||
{% accessibilityDemo /%} |
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
...ystem/components/progress-rope/accessibility/colour-impairment-demonstration/content.mdoc
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,3 @@ | ||
{% shortCode name="accessibility-colour-impairment" /%} | ||
|
||
{% accessibilityDemo /%} |
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
...-system/components/radio-group/accessibility/colour-impairment-demonstration/content.mdoc
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,3 @@ | ||
{% shortCode name="accessibility-colour-impairment" /%} | ||
|
||
{% accessibilityDemo /%} |
Oops, something went wrong.