Skip to content

Commit 960ac15

Browse files
committed
Return to stable uswds and nasawds releases
- uswds/uswds#5825 has been fixed. - https://github.com/lpsinger/react-uswds/tree/gcn is the same as trussworks/react-uswds#2726, but rebased. - I had to update some CSS where we have heavily customized the appearance of some USWDS components.
1 parent c4542e0 commit 960ac15

File tree

15 files changed

+142
-93
lines changed

15 files changed

+142
-93
lines changed

app/components/CredentialCard.tsx

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
import { useRef } from 'react'
2020

2121
import TimeAgo from './TimeAgo'
22+
import { ToolbarButtonGroup } from './ToolbarButtonGroup'
2223
import type { RedactedClientCredential } from '~/routes/user.credentials/client_credentials.server'
2324

2425
export default function CredentialCard({
@@ -54,33 +55,35 @@ export default function CredentialCard({
5455
</div>
5556
</div>
5657
<div className="tablet:grid-col flex-auto margin-y-auto">
57-
<ModalToggleButton
58-
opener
59-
disabled={disabled}
60-
modalRef={ref}
61-
type="button"
62-
className="usa-button--secondary"
63-
>
64-
<Icon.Delete
65-
role="presentation"
66-
className="bottom-aligned margin-right-05"
67-
/>
68-
Delete
69-
</ModalToggleButton>
70-
<Form
71-
method="GET"
72-
action="/quickstart/alerts"
73-
className="display-inline"
74-
>
75-
<input type="hidden" name="clientId" value={client_id} />
76-
<Button disabled={disabled} type="submit">
77-
Select
78-
<Icon.ArrowForward
58+
<ToolbarButtonGroup>
59+
<ModalToggleButton
60+
opener
61+
disabled={disabled}
62+
modalRef={ref}
63+
type="button"
64+
className="usa-button--secondary"
65+
>
66+
<Icon.Delete
7967
role="presentation"
80-
className="bottom-aligned margin-left-05"
68+
className="bottom-aligned margin-right-05"
8169
/>
82-
</Button>
83-
</Form>
70+
Delete
71+
</ModalToggleButton>
72+
<Form
73+
method="GET"
74+
action="/quickstart/alerts"
75+
className="display-inline"
76+
>
77+
<input type="hidden" name="clientId" value={client_id} />
78+
<Button disabled={disabled} type="submit">
79+
Select
80+
<Icon.ArrowForward
81+
role="presentation"
82+
className="bottom-aligned margin-left-05"
83+
/>
84+
</Button>
85+
</Form>
86+
</ToolbarButtonGroup>
8487
</div>
8588
</Grid>
8689
<Modal
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.toolbar :global(.usa-button) {
2+
text-wrap: nowrap;
3+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/*!
2+
* Copyright © 2023 United States Government as represented by the
3+
* Administrator of the National Aeronautics and Space Administration.
4+
* All Rights Reserved.
5+
*
6+
* SPDX-License-Identifier: Apache-2.0
7+
*/
8+
import { ButtonGroup } from '@trussworks/react-uswds'
9+
import classNames from 'classnames'
10+
11+
import styles from './index.module.css'
12+
13+
/**
14+
* A segmented button group with some styling appropriate for toolbars.
15+
*
16+
* - Do not wrap the text within buttons.
17+
*/
18+
export function ToolbarButtonGroup({
19+
className,
20+
...props
21+
}: Omit<Parameters<typeof ButtonGroup>[0], 'type'>) {
22+
return (
23+
<ButtonGroup
24+
className={classNames(className, 'flex-auto', styles.toolbar)}
25+
{...props}
26+
/>
27+
)
28+
}

app/components/tabs/index.module.scss

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,11 @@
77
*/
88

99
.tabs {
10+
&,
11+
& :global(.usa-button-group.usa-button-group--segmented) {
12+
align-items: end;
13+
}
14+
1015
:global(.usa-button-group__item) {
1116
:global(.usa-button) {
1217
box-shadow: 0px 0px 0px 0px;

app/img/checkbox-indeterminate.svg

Lines changed: 0 additions & 10 deletions
This file was deleted.

app/routes/circulars.$circularId.($version)/route.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ import { MarkdownBody, PlainTextBody } from './Body'
1818
import { FrontMatter } from './FrontMatter'
1919
import DetailsDropdownButton from '~/components/DetailsDropdownButton'
2020
import DetailsDropdownContent from '~/components/DetailsDropdownContent'
21+
import { ToolbarButtonGroup } from '~/components/ToolbarButtonGroup'
2122
import { origin } from '~/lib/env.server'
2223
import { getCanonicalUrlHeaders, pickHeaders } from '~/lib/headers.server'
2324
import { useSearchString } from '~/lib/utils'
@@ -72,8 +73,11 @@ export default function () {
7273
}`
7374
return (
7475
<>
75-
<ButtonGroup>
76-
<Link to={`/circulars${searchString}`} className="usa-button">
76+
<ToolbarButtonGroup className="flex-wrap">
77+
<Link
78+
to={`/circulars${searchString}`}
79+
className="usa-button flex-align-stretch"
80+
>
7781
<div className="position-relative">
7882
<Icon.ArrowBack
7983
role="presentation"
@@ -135,7 +139,7 @@ export default function () {
135139
Edit
136140
</Link>
137141
)}
138-
</ButtonGroup>
142+
</ToolbarButtonGroup>
139143
<h1 className="margin-bottom-0">GCN Circular {circularId}</h1>
140144
<FrontMatter {...frontMatter} />
141145
<Body className="margin-y-2">{body}</Body>

app/routes/circulars._archive._index/DateSelectorMenu.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ function DateSelectorButton({
4242
endDate?: string
4343
expanded?: boolean
4444
} & Omit<Parameters<typeof ButtonGroup>[0], 'segmented' | 'children'>) {
45-
const slimClasses = 'height-4 padding-y-0'
45+
const slimClasses = 'padding-y-1'
4646

4747
return (
4848
<ButtonGroup type="segmented" {...props}>

app/routes/circulars._archive._index/SortSelectorButton.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function SortButton({
3131
sort?: string
3232
expanded?: boolean
3333
} & Omit<Parameters<typeof ButtonGroup>[0], 'segmented' | 'children'>) {
34-
const slimClasses = 'height-4 padding-y-0'
34+
const slimClasses = 'padding-y-1'
3535

3636
return (
3737
<ButtonGroup type="segmented" {...props}>

app/routes/circulars._archive._index/route.tsx

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import {
1717
import {
1818
Alert,
1919
Button,
20-
ButtonGroup,
2120
Icon,
2221
Label,
2322
Select,
@@ -46,6 +45,7 @@ import CircularsIndex from './CircularsIndex'
4645
import { DateSelector } from './DateSelectorMenu'
4746
import { SortSelector } from './SortSelectorButton'
4847
import Hint from '~/components/Hint'
48+
import { ToolbarButtonGroup } from '~/components/ToolbarButtonGroup'
4949
import { origin } from '~/lib/env.server'
5050
import { getFormDataString } from '~/lib/utils'
5151
import { postZendeskRequest } from '~/lib/zendesk.server'
@@ -185,7 +185,7 @@ export default function () {
185185
{requestedChangeCount > 1 ? 's' : ''}
186186
</Link>
187187
)}
188-
<ButtonGroup className="position-sticky top-0 bg-white margin-bottom-1 padding-top-1 z-300">
188+
<ToolbarButtonGroup className="position-sticky top-0 bg-white margin-bottom-1 padding-top-1 z-300">
189189
<Form
190190
preventScrollReset
191191
className="display-inline-block usa-search usa-search--small"
@@ -197,6 +197,7 @@ export default function () {
197197
</Label>
198198
<TextInput
199199
autoFocus
200+
className="minw-15"
200201
id="query"
201202
name="query"
202203
type="search"
@@ -223,14 +224,11 @@ export default function () {
223224
/>
224225
{query && <SortSelector form={formId} defaultValue={sort} />}
225226
<Link to={`/circulars/new${searchString}`}>
226-
<Button
227-
type="button"
228-
className="height-4 padding-top-0 padding-bottom-0"
229-
>
227+
<Button type="button" className="padding-y-1">
230228
<Icon.Edit role="presentation" /> New
231229
</Button>
232230
</Link>
233-
</ButtonGroup>
231+
</ToolbarButtonGroup>
234232
<Hint id="searchHint">
235233
Search for Circulars by submitter, subject, or body text (e.g. 'Fermi
236234
GRB'). <br />

app/routes/circulars.edit.$circularId/RichEditor/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ import iconTable from '@gitlab/svgs/dist/sprite_icons/table.svg'
4444
function SlimButton({ className, ...props }: Parameters<typeof Button>[0]) {
4545
return (
4646
<Button
47-
className={classNames(className, 'height-4 padding-y-0 padding-x-105')}
47+
className={classNames(className, 'height-4 padding-y-1 padding-x-105')}
4848
{...props}
4949
/>
5050
)

0 commit comments

Comments
 (0)