-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update iconography and country symbol foundation docs (#4391)
Co-authored-by: Amrita Desmet <[email protected]> Co-authored-by: origami-z <[email protected]> Co-authored-by: Josh Wooding <[email protected]>
- Loading branch information
1 parent
9d5a37f
commit 5748872
Showing
24 changed files
with
370 additions
and
83 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
--- | ||
title: Accent | ||
layout: DetailTechnical | ||
sidebar: | ||
priority: 14 | ||
data: | ||
status: In progress | ||
--- | ||
|
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
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
--- | ||
title: Division | ||
layout: DetailTechnical | ||
sidebar: | ||
priority: 11 | ||
data: | ||
status: In progress | ||
--- | ||
|
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 was deleted.
Oops, something went wrong.
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,36 @@ | ||
--- | ||
title: Country symbols | ||
layout: DetailTechnical | ||
--- | ||
|
||
Country symbols represent a specific country and are used in contexts where geographical identification is necessary. They can be considered icons that are visually representative of a country or inter-governmental organisation. All country symbols are available in both circle and rectangle shapes. | ||
|
||
<Image | ||
src="/img/foundations/iconography-countrysymbols-variant.png" | ||
alt="Example of circular country symbols next to rectangular country symbols" | ||
/> | ||
|
||
## All country symbols | ||
|
||
<CountrySymbolPreview /> | ||
|
||
## Scaling country symbols | ||
|
||
Country symbols have a standard size that changes in multiples across all four density levels. | ||
|
||
<ImageSwitcher | ||
images={[ | ||
{ src: "/img/foundations/scale-country.svg", alt: "" }, | ||
{ src: "/img/foundations/scale-country-annotated.svg", alt: "" }, | ||
]} | ||
label="Show multipliers" | ||
/> | ||
|
||
| Size token | Multiplier | High Density (HD) | Medium Density (MD) | Low Density (LD) | Touch Density (TD) | | ||
| ------------------ | ---------- | ----------------- | ------------------- | ---------------- | ------------------ | | ||
| `--salt-size-base` | x1 | 20 | 28 | 36 | 44 | | ||
| | x2 | 40 | 56 | 72 | 88 | | ||
| | x3 | 60 | 84 | 108 | 132 | | ||
| | x4 | 80 | 112 | 144 | 176 | | ||
|
||
:fragment{src="./../fragments/feedback.mdx"} |
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,48 @@ | ||
--- | ||
title: Icons | ||
layout: DetailTechnical | ||
sidebar: | ||
groupLabel: Iconography | ||
label: Icons | ||
priority: 9 | ||
--- | ||
|
||
Icons are simplified visual representations of a specific action, object or concept. | ||
|
||
## Icon variants | ||
|
||
Icons come in two variant types: **Outline** and **Solid**. Please note that all icons within the icon set have an outline variant, but not all icons have a solid variant. | ||
|
||
**Solid icons** may be faster to recognise than outline icons due to less visual noise, especially depending on the complexity of the icon. Solid icons better represent how we view objects, whereas outline icons are silhouettes and therefore can take longer to perceive. | ||
|
||
**Outline icons** place less emphasis on non-imperative items and are more recognizable when they have wider inner spacing. They’re also better to use when you need to make subtle design cues more noticeable. | ||
|
||
<Image | ||
src="/img/foundations/iconography-icon-variants.png" | ||
alt="Example of solid and outline icons" | ||
/> | ||
|
||
## All icons | ||
|
||
<IconPreview /> | ||
|
||
## Scaling icons | ||
|
||
Icon size will vary based on use case and system requirements. Standard sizing ensures components maintain a consistent spatial relationship with surrounding elements. | ||
|
||
<ImageSwitcher | ||
images={[ | ||
{ src: "/img/foundations/scale-icon.svg", alt: "" }, | ||
{ src: "/img/foundations/scale-icon-annotated.svg", alt: "" }, | ||
]} | ||
label="Show multipliers" | ||
/> | ||
|
||
| Size token | Multiplier | High Density (HD) | Medium Density (MD) | Low Density (LD) | Touch Density (TD) | | ||
| ------------------ | ---------- | ----------------- | ------------------- | ---------------- | ------------------ | | ||
| `--salt-size-icon` | x1 | 12 \* | 12 | 14 | 16 | | ||
| | x2 | 20 | 24 | 28 | 32 | | ||
| | x3 | 30 | 36 | 42 | 48 | | ||
| | x4 | 40 | 48 | 56 | 64 | | ||
|
||
\* Icons have a minimum size set at 12px and should not be displayed any smaller. For high density this means the default size of an icon is 12px, but the rest of the scale grows based on small base dimension. |
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
--- | ||
title: Modes | ||
layout: DetailTechnical | ||
sidebar: | ||
priority: 8 | ||
data: | ||
status: In progress | ||
--- | ||
|
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
--- | ||
title: Opacity | ||
layout: DetailTechnical | ||
sidebar: | ||
priority: 7 | ||
data: | ||
status: In progress | ||
--- | ||
|
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
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 |
---|---|---|
@@ -1,6 +1,8 @@ | ||
--- | ||
title: Shadow | ||
layout: DetailTechnical | ||
sidebar: | ||
priority: 4 | ||
data: | ||
status: In progress | ||
--- | ||
|
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 28 additions & 0 deletions
28
site/src/components/country-symbol-preview/CountrySymbolPreview.module.css
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,28 @@ | ||
.root { | ||
min-height: 400px; | ||
} | ||
|
||
.formfield { | ||
display: flex; | ||
} | ||
|
||
.search { | ||
max-width: 40ch; | ||
flex: 1; | ||
} | ||
|
||
.symbolsContainer { | ||
overflow: auto; | ||
max-height: 800px; | ||
margin-top: var(--salt-spacing-300); | ||
} | ||
|
||
.notFound { | ||
flex: 1; | ||
justify-content: center; | ||
} | ||
|
||
.symbolCount { | ||
display: flex; | ||
align-items: center; | ||
} |
115 changes: 115 additions & 0 deletions
115
site/src/components/country-symbol-preview/CountrySymbolPreview.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,115 @@ | ||
import { | ||
Button, | ||
FlexItem, | ||
FlexLayout, | ||
FlowLayout, | ||
Input, | ||
StackLayout, | ||
StatusIndicator, | ||
Text, | ||
} from "@salt-ds/core"; | ||
import { LazyCountrySymbol, countryMetaMap } from "@salt-ds/countries"; | ||
import { CloseIcon, SearchIcon } from "@salt-ds/icons"; | ||
import { | ||
type ChangeEvent, | ||
Suspense, | ||
useDeferredValue, | ||
useMemo, | ||
useState, | ||
} from "react"; | ||
import styles from "./CountrySymbolPreview.module.css"; | ||
|
||
export const CountrySymbolPreview = () => { | ||
const [search, setSearch] = useState(""); | ||
const deferredSearch = useDeferredValue(search.toLowerCase()); | ||
|
||
const handleSearch = (event: ChangeEvent<HTMLInputElement>) => { | ||
setSearch(event.target.value); | ||
}; | ||
|
||
const handleClear = () => { | ||
setSearch(""); | ||
}; | ||
|
||
const filteredSymbols = useMemo(() => { | ||
return Object.values(countryMetaMap).filter( | ||
({ countryCode, countryName }) => | ||
countryCode.toLowerCase().includes(deferredSearch) || | ||
countryName.toLowerCase().includes(deferredSearch), | ||
); | ||
}, [deferredSearch]); | ||
|
||
const renderSymbols = useMemo(() => { | ||
if (filteredSymbols.length > 0) { | ||
return ( | ||
<FlowLayout justify="start" gap={1}> | ||
{filteredSymbols.map(({ countryCode, countryName }) => ( | ||
<StackLayout | ||
style={{ width: 140 }} | ||
gap={1} | ||
align="center" | ||
key={countryCode} | ||
> | ||
<LazyCountrySymbol code={countryCode} size={1} /> | ||
<StackLayout gap={0} align="center"> | ||
<Text>{countryCode}</Text> | ||
<Text style={{ textAlign: "center" }}>{countryName}</Text> | ||
</StackLayout> | ||
</StackLayout> | ||
))} | ||
</FlowLayout> | ||
); | ||
} | ||
return ( | ||
<StackLayout className={styles.notFound} gap={3} align="center"> | ||
<StatusIndicator status="info" size={2} /> | ||
<StackLayout gap={1} align="center"> | ||
<Text styleAs="h4"> | ||
<strong>No country symbols found</strong> | ||
</Text> | ||
<Text> | ||
No country symbols found for the search term: " | ||
<strong>{deferredSearch}</strong>" | ||
</Text> | ||
</StackLayout> | ||
</StackLayout> | ||
); | ||
}, [filteredSymbols, deferredSearch]); | ||
|
||
return ( | ||
<Suspense fallback="Loading..."> | ||
<StackLayout className={styles.root} gap={1}> | ||
<FlexLayout direction="row"> | ||
<FlexItem> | ||
<Input | ||
placeholder="Search country symbols" | ||
aria-label="Search country symbols" | ||
value={search} | ||
onChange={handleSearch} | ||
className={styles.search} | ||
startAdornment={<SearchIcon />} | ||
endAdornment={ | ||
search ? ( | ||
<Button | ||
onClick={handleClear} | ||
appearance="transparent" | ||
sentiment="neutral" | ||
aria-label="Clear search" | ||
> | ||
<CloseIcon aria-hidden /> | ||
</Button> | ||
) : null | ||
} | ||
/> | ||
</FlexItem> | ||
<FlexItem className={styles.formfield}> | ||
<Text className={styles.symbolCount}> | ||
Symbol Count: {filteredSymbols.length} | ||
</Text> | ||
</FlexItem> | ||
</FlexLayout> | ||
<div className={styles.symbolsContainer}>{renderSymbols}</div> | ||
</StackLayout> | ||
</Suspense> | ||
); | ||
}; |
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 @@ | ||
export * from "./CountrySymbolPreview"; |
Oops, something went wrong.