-
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.
docs: polish iconography foundations
- split into 2 pages, icons and country symbols, to aid readability - added filters to icon preview, so you can show/hide solid/outline icons - aligned the country symbol preview component with the icon preview (clear button etc, no results view)
- Loading branch information
1 parent
91973ac
commit 4bd1536
Showing
22 changed files
with
322 additions
and
75 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,39 @@ | ||
--- | ||
title: Country Symbols | ||
layout: DetailTechnical | ||
--- | ||
|
||
Country symbols represent a specific country and are used in contexts where geographical identification is necessary. | ||
|
||
- Country symbols can be considered icons that are visually representative of a country or inter-governmental organisation. | ||
- All flags are available in both circle and rectangle shapes. | ||
|
||
<Image | ||
src="/img/foundations/iconography-countrysymbols-variant.png" | ||
alt="Example of circular flag next to rectangular flag" | ||
/> | ||
|
||
## 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 (px) | Medium | Low | Touch | | ||
| ------------------ | ---------- | ----------------- | ------ | --- | ----- | | ||
| `--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,46 @@ | ||
--- | ||
title: Icons | ||
layout: DetailTechnical | ||
sidebar: | ||
groupLabel: Iconography | ||
label: Icons | ||
priority: 9 | ||
--- | ||
|
||
Icons are simplified visual representations of a specific action, object or concept. | ||
|
||
<Image | ||
src="/img/foundations/iconography-icon-variants.png" | ||
alt="Example of solid and outline icons" | ||
/> | ||
|
||
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** are faster to recognize than outline icons due to less visual noise, especially when the icon is complex. 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. | ||
|
||
## 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 (px) | Medium | Low | Touch | | ||
| ------------------ | ---------- | ----------------- | ------ | --- | ----- | | ||
| `--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.
113 changes: 113 additions & 0 deletions
113
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,113 @@ | ||
import { | ||
FlexLayout, | ||
FlexItem, | ||
FlowLayout, | ||
Input, | ||
StackLayout, | ||
Text, | ||
Button, | ||
StatusIndicator, | ||
} from "@salt-ds/core"; | ||
import { LazyCountrySymbol, countryMetaMap } from "@salt-ds/countries"; | ||
import { | ||
ChangeEvent, | ||
Suspense, | ||
useDeferredValue, | ||
useMemo, | ||
useState, | ||
} from "react"; | ||
import styles from "../icon-preview/IconPreview.module.css"; | ||
import { CloseIcon, SearchIcon } from "@salt-ds/icons"; | ||
|
||
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} /> | ||
<Text>{countryCode}</Text> | ||
<Text style={{ textAlign: "center" }}>{countryName}</Text> | ||
</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> | ||
) | ||
} | ||
/> | ||
</FlexItem> | ||
</FlexLayout> | ||
<div | ||
className={styles.symbolsContainer} | ||
style={{ overflow: "auto", maxHeight: 800, marginTop: "12px" }} | ||
> | ||
{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.