Skip to content

Commit ea6cf69

Browse files
twjefferyvanessatran-ddi
authored andcommitted
feat/1870: add design guideline content for button page
1 parent 680ad9c commit ea6cf69

File tree

2 files changed

+125
-8
lines changed

2 files changed

+125
-8
lines changed

src/components/component-header/ComponentHeader.tsx

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,13 @@ export const ComponentHeader: React.FC<Props> = (props: Props) => {
3737
))}
3838
</>
3939
)}
40+
41+
42+
<p><a
43+
href="https://github.com/GovAlta/ui-components-docs/blob/b5693af3a5b6c2ef08f8d3d233d617ce38f74ce3/src/routes/components/Button.tsx"
44+
target="_blank">
45+
Edit this page
46+
</a></p>
4047
</div>
4148
);
4249
};

src/routes/components/Button.tsx

Lines changed: 118 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import { useState } from "react";
22
import {
3-
GoABadge,
43
GoABlock,
54
GoAButton,
65
GoAButtonGroup,
@@ -10,7 +9,11 @@ import {
109
GoAInput,
1110
GoATab,
1211
GoATabs,
12+
GoAContainer,
13+
GoAGrid,
14+
GoADivider
1315
} from "@abgov/react-components";
16+
import { DoDont } from "@components/do-dont/DoDont";
1417
import { Sandbox, ComponentBinding } from "@components/sandbox";
1518
import { CodeSnippet } from "@components/code-snippet/CodeSnippet";
1619
import { GoAModal } from "@components/mock-modal/Modal";
@@ -126,6 +129,7 @@ export default function ButtonPage() {
126129
},
127130
];
128131
const noop = () => { };
132+
const minGridWidth = "36ch";
129133

130134
function SandboxOnChange(bindings: ComponentBinding[], props: Record<string, unknown>) {
131135
setButtonBindings(bindings);
@@ -144,8 +148,14 @@ export default function ButtonPage() {
144148
/>
145149

146150
<ComponentContent tocCssQuery="goa-tab[open=true] :is(h2[id], h3[id])">
151+
152+
147153
<GoATabs>
148-
<GoATab heading="Code examples">
154+
155+
156+
{/*Code Examples-----------------------------------------------------------------------*/}
157+
158+
<GoATab heading="Examples">
149159
{/*Button Sandbox*/}
150160
<h2 id="component" style={{display: "none"}}>Component</h2>
151161
<Sandbox properties={buttonBindings} onChange={SandboxOnChange}>
@@ -255,15 +265,115 @@ export default function ButtonPage() {
255265
</GoAButtonGroup>
256266
</Sandbox>
257267
</GoATab>
258-
268+
269+
270+
{/*Design guidelines-----------------------------------------------------------------------*/}
271+
259272
<GoATab
260273
heading={
261-
<>
262-
Design guidelines
263-
<GoABadge type="information" content="In progress" />
264-
</>
274+
<>Design guidelines</>
265275
}>
266-
<p>Coming Soon</p>
276+
<p>
277+
<a
278+
href="https://www.figma.com/design/3pb2IK8s2QUqWieH79KdN7/%E2%9D%96-Component-library-%7C-DDD?node-id=420-6810"
279+
target="_blank">
280+
View component in Figma
281+
</a>
282+
</p>
283+
<h2 id="types">Types</h2>
284+
<h3>There are 5 types of buttons: primary, secondary, tertiary, start, and destructive.</h3>
285+
286+
<GoAContainer>
287+
<GoAButtonGroup alignment="start">
288+
<GoAButton type="primary" onClick={noop}>
289+
Primary
290+
</GoAButton>
291+
<GoAButton type="secondary" onClick={noop}>
292+
Secondary
293+
</GoAButton>
294+
<GoAButton type="tertiary" onClick={noop}>
295+
Tertiary
296+
</GoAButton>
297+
<GoAButton type="start" onClick={noop}>
298+
Get started
299+
</GoAButton>
300+
<GoAButton type="primary" variant="destructive" onClick={noop}>
301+
Destructive
302+
</GoAButton>
303+
</GoAButtonGroup>
304+
</GoAContainer>
305+
306+
<div className="dodont-wrapper">
307+
<GoAGrid minChildWidth={minGridWidth} gap="2xl">
308+
<DoDont
309+
type="do"
310+
description="Use a primary button for the primary action on the page. For citizen
311+
facing applications there should generally only be one primary button on a page.">
312+
<p>image</p>
313+
</DoDont>
314+
315+
<DoDont type="dont" description="Don’t use two primary buttons.">
316+
<p>image</p>
317+
</DoDont>
318+
</GoAGrid>
319+
320+
<GoAGrid minChildWidth={minGridWidth} gap="2xl" mt="2xl" mb="3xl">
321+
<DoDont
322+
type="do"
323+
description="Use a start button for the main call to action on your service’s
324+
start page. This is the “front door” to your service on Alberta.ca.">
325+
<p>image</p>
326+
</DoDont>
327+
</GoAGrid>
328+
</div>
329+
330+
<GoADivider mt="3xl" mb="3xl"></GoADivider>
331+
332+
<h2 id="accessibility">Accessibility</h2>
333+
<h3>Users with visual impairment often use screen readers and other assistive
334+
technology to help them navigate a service.</h3>
335+
<p>
336+
<a
337+
href="https://w3c.github.io/wcag/understanding/target-size-minimum.html"
338+
target="_blank">
339+
View more information on web accessibility from WCAG
340+
</a>
341+
</p>
342+
343+
<div className="dodont-wrapper">
344+
<GoAGrid minChildWidth={minGridWidth} gap="2xl">
345+
<DoDont
346+
type="do"
347+
description="Use a primary button for the primary action on the page. For citizen
348+
facing applications there should generally only be one primary button on a page.">
349+
<p>image</p>
350+
</DoDont>
351+
352+
<DoDont type="dont" description="Don’t use two primary buttons.">
353+
<p>image</p>
354+
</DoDont>
355+
</GoAGrid>
356+
</div>
357+
358+
<GoADivider mt="3xl" mb="3xl"></GoADivider>
359+
360+
<h2 id="contribution">Design contribution</h2>
361+
<GoAContainer type="non-interactive" accent="filled" padding="relaxed">
362+
<h3>
363+
<a
364+
href="https://www.figma.com/design/jDsIoiKh5ViZRWJdS0Dgtf/Component---Button?t=Ub6ZLMiI17pE4Rhe-1"
365+
target="_blank">
366+
Figma contribution file
367+
</a>
368+
</h3>
369+
<p>
370+
Propose changes, contribute new ideas, and see the research and iterations
371+
that has gone into the current design.
372+
</p>
373+
</GoAContainer>
374+
375+
<GoADivider mt="3xl" mb="xl"></GoADivider>
376+
267377
</GoATab>
268378
</GoATabs>
269379
</ComponentContent>

0 commit comments

Comments
 (0)