Skip to content

Commit a597964

Browse files
nick-nlbpablonoel
andauthored
Facet Selector Adjustments (datacommonsorg#5214)
## Description This PR makes the following adjustments to the layout and copy of the facet selector: - "Close" has become "Cancel" in the facet selector modal. - The "action" button in the modals now appear on the right. In other words, "Update" appears to the right of "Cancel". This will be the standard going forward. - The facet selector is now rounded and has a smaller font to better match its surroundings in the chart. ## Notes The font size here is a special case (to match the design of the existing charts) but is otherwise not part of the current design standard. Therefore we applied it specifically to these components only rather than adding it to the theme. ## Screenshots ### Modal buttons <img width="639" alt="Screenshot 2025-06-16 at 1 36 37 PM" src="https://github.com/user-attachments/assets/6b7337a7-2d31-4dde-928b-e4db74b8e2b9" /> ### Facet selector update <img width="845" alt="Screenshot 2025-06-16 at 2 13 39 PM" src="https://github.com/user-attachments/assets/7bbc9698-797a-4df0-84a2-8b197d91b23c" /> --------- Co-authored-by: Pablo Noel <pablo@next-solutions.ca>
1 parent fa5bd9d commit a597964

6 files changed

Lines changed: 32 additions & 22 deletions

File tree

static/js/apps/visualization/chart_header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ export function ChartHeader(props: ChartHeaderProps): ReactElement {
103103
gap: ${theme.spacing.sm}px;
104104
background: ${theme.colors.box.tooltip.pill};
105105
${theme.typography.family.text};
106-
${theme.typography.text.sm};
106+
font-size: 13px;
107107
`}
108108
>
109109
{inputSection.label && (

static/js/i18n/i18n_messages.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,18 @@ export const messages = defineMessages({
7272
description:
7373
"Subtitle for the metadata modal showing the list of variables to show source information for",
7474
},
75+
cancel: {
76+
id: "cancel",
77+
defaultMessage: "Cancel",
78+
description:
79+
"Button to close a modal or other interactive element without applying changes",
80+
},
7581
close: {
7682
id: "close",
7783
defaultMessage: "Close",
78-
description: "Button to close the metadata modal",
84+
description:
85+
"Button to close a modal or other interactive element. Unlike 'Cancel', this doesn not imply abandoning " +
86+
"changes; it simply dismisses the dialog. It is used when there are no contrasting actions.",
7987
},
8088
download: {
8189
id: "download",

static/js/shared/facet_selector.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,11 @@ export function FacetSelector(props: FacetSelectorPropType): ReactElement {
125125
<Button
126126
className={`${SELECTOR_PREFIX}-open-modal-button`}
127127
variant="flat"
128+
size="sm"
128129
onClick={(): void => setModalOpen(true)}
129130
disabled={loading || !totalFacetOptionCount}
130131
css={css`
132+
font-size: 13px;
131133
flex-shrink: 0;
132134
visibility: ${loading || !totalFacetOptionCount
133135
? "hidden"
@@ -239,19 +241,19 @@ export function FacetSelector(props: FacetSelectorPropType): ReactElement {
239241
})}
240242
</DialogContent>
241243
<DialogActions>
242-
<Button
243-
onClick={onConfirm}
244-
className={`${SELECTOR_PREFIX}-update-source-button`}
245-
>
246-
{intl.formatMessage(facetSelectionComponentMessages.Update)}
247-
</Button>
248244
<Button
249245
variant="text"
250246
onClick={(): void => {
251247
setModalOpen(false);
252248
}}
253249
>
254-
{intl.formatMessage(messages.close)}
250+
{intl.formatMessage(messages.cancel)}
251+
</Button>
252+
<Button
253+
onClick={onConfirm}
254+
className={`${SELECTOR_PREFIX}-update-source-button`}
255+
>
256+
{intl.formatMessage(facetSelectionComponentMessages.Update)}
255257
</Button>
256258
</DialogActions>
257259
</Dialog>

static/js/theme/theme.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,7 @@ const theme: Theme = {
350350
color: DC_BLUE,
351351
backgroundColor: DC_BLUE_WHITE_LIGHT,
352352
border: `1px solid ${DC_BLUE_WHITE_LIGHT}`,
353-
borderRadius: `8px`,
353+
borderRadius: "100px",
354354
["&:hover:not(:disabled):not([aria-disabled])"]: {
355355
backgroundColor: DC_BLUE_WHITE_LIGHT,
356356
color: DC_BLUE,
@@ -360,7 +360,7 @@ const theme: Theme = {
360360
},
361361
size: {
362362
sm: {
363-
padding: `6px ${SPACING.md}px`,
363+
padding: `7px ${SPACING.md}px`,
364364
},
365365
md: {
366366
padding: `11px ${SPACING.md}px 9px`,

static/js/tools/shared/metadata/tile_metadata_modal.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -164,11 +164,6 @@ export function TileMetadataModal(
164164
)}
165165
</DialogContent>
166166
<DialogActions>
167-
{!error && (
168-
<CopyCitationButton citationToCopy={citationText}>
169-
{intl.formatMessage(metadataComponentMessages.CopyCitation)}
170-
</CopyCitationButton>
171-
)}
172167
<Button
173168
variant="text"
174169
onClick={(): void => {
@@ -177,6 +172,11 @@ export function TileMetadataModal(
177172
>
178173
{intl.formatMessage(messages.close)}
179174
</Button>
175+
{!error && (
176+
<CopyCitationButton citationToCopy={citationText}>
177+
{intl.formatMessage(metadataComponentMessages.CopyCitation)}
178+
</CopyCitationButton>
179+
)}
180180
</DialogActions>
181181
</Dialog>
182182
</>

static/js/tools/timeline/__snapshots__/page.test.tsx.snap

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
exports[`Single place and single stat var 1`] = `
44
"<div class=\\"chart-container dc-async-element-holder\\">
5-
<div class=\\"css-1w3kops\\"><button type=\\"button\\" class=\\"button button-flat button-md source-selector-open-modal-button css-1upohkl\\">Select a dataset [1]</button></div>
5+
<div class=\\"css-1w3kops\\"><button type=\\"button\\" class=\\"button button-flat button-sm source-selector-open-modal-button css-1t9rw4w\\">Select a dataset [1]</button></div>
66
<div class=\\"card\\">
77
<div class=\\"statVarChipRegion\\">
88
<div class=\\"chip\\"><span class=\\"chip-text chip-clickable-text\\">Age</span><button class=\\"chip-action\\"><i class=\\"material-icons\\">cancel</i></button></div>
@@ -23,7 +23,7 @@ exports[`Single place and single stat var 1`] = `
2323
2424
exports[`Single place and single stat var 2`] = `
2525
"<div class=\\"chart-container dc-async-element-holder\\">
26-
<div class=\\"css-1w3kops\\"><button type=\\"button\\" class=\\"button button-flat button-md source-selector-open-modal-button css-1upohkl\\">Select a dataset [1]</button></div>
26+
<div class=\\"css-1w3kops\\"><button type=\\"button\\" class=\\"button button-flat button-sm source-selector-open-modal-button css-1t9rw4w\\">Select a dataset [1]</button></div>
2727
<div class=\\"card\\">
2828
<div class=\\"statVarChipRegion\\">
2929
<div class=\\"chip\\"><span class=\\"chip-text chip-clickable-text\\">Population</span><button class=\\"chip-action\\"><i class=\\"material-icons\\">cancel</i></button></div>
@@ -41,7 +41,7 @@ exports[`Single place and single stat var 2`] = `
4141
<div class=\\"feedback-link\\"><a href=\\"/feedback\\">Feedback</a></div>
4242
</div>
4343
<div class=\\"chart-container dc-async-element-holder\\">
44-
<div class=\\"css-1w3kops\\"><button type=\\"button\\" class=\\"button button-flat button-md source-selector-open-modal-button css-1upohkl\\">Select a dataset [1]</button></div>
44+
<div class=\\"css-1w3kops\\"><button type=\\"button\\" class=\\"button button-flat button-sm source-selector-open-modal-button css-1t9rw4w\\">Select a dataset [1]</button></div>
4545
<div class=\\"card\\">
4646
<div class=\\"statVarChipRegion\\">
4747
<div class=\\"chip\\"><span class=\\"chip-text chip-clickable-text\\">Age</span><button class=\\"chip-action\\"><i class=\\"material-icons\\">cancel</i></button></div>
@@ -62,7 +62,7 @@ exports[`Single place and single stat var 2`] = `
6262
6363
exports[`Single place and single stat var 3`] = `
6464
"<div class=\\"chart-container dc-async-element-holder\\">
65-
<div class=\\"css-1w3kops\\"><button type=\\"button\\" class=\\"button button-flat button-md source-selector-open-modal-button css-1upohkl\\">Select a dataset [1]</button></div>
65+
<div class=\\"css-1w3kops\\"><button type=\\"button\\" class=\\"button button-flat button-sm source-selector-open-modal-button css-1t9rw4w\\">Select a dataset [1]</button></div>
6666
<div class=\\"card\\">
6767
<div class=\\"statVarChipRegion\\">
6868
<div class=\\"chip\\"><span class=\\"chip-text chip-clickable-text\\">Population</span><button class=\\"chip-action\\"><i class=\\"material-icons\\">cancel</i></button></div>
@@ -121,7 +121,7 @@ exports[`Single place and single stat var 4`] = `
121121
122122
exports[`chart options 1`] = `
123123
"<div class=\\"chart-container dc-async-element-holder\\">
124-
<div class=\\"css-1w3kops\\"><button type=\\"button\\" class=\\"button button-flat button-md source-selector-open-modal-button css-1upohkl\\">Select a dataset [1]</button></div>
124+
<div class=\\"css-1w3kops\\"><button type=\\"button\\" class=\\"button button-flat button-sm source-selector-open-modal-button css-1t9rw4w\\">Select a dataset [1]</button></div>
125125
<div class=\\"card\\">
126126
<div class=\\"statVarChipRegion\\">
127127
<div class=\\"chip\\"><span class=\\"chip-text chip-clickable-text\\">Population</span><button class=\\"chip-action\\"><i class=\\"material-icons\\">cancel</i></button></div>
@@ -142,7 +142,7 @@ exports[`chart options 1`] = `
142142
143143
exports[`statVar not in PV-tree 1`] = `
144144
"<div class=\\"chart-container dc-async-element-holder\\">
145-
<div class=\\"css-1w3kops\\"><button type=\\"button\\" class=\\"button button-flat button-md source-selector-open-modal-button css-1upohkl\\">Select a dataset [1]</button></div>
145+
<div class=\\"css-1w3kops\\"><button type=\\"button\\" class=\\"button button-flat button-sm source-selector-open-modal-button css-1t9rw4w\\">Select a dataset [1]</button></div>
146146
<div class=\\"card\\">
147147
<div class=\\"statVarChipRegion\\">
148148
<div class=\\"chip\\"><span class=\\"chip-text chip-clickable-text\\"></span><button class=\\"chip-action\\"><i class=\\"material-icons\\">cancel</i></button></div>

0 commit comments

Comments
 (0)