-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #400 from WestpacGEL/395-symbols-search-feature-an…
…d-symbols-are-missing-in-gel-next 395 symbols search feature and symbols are missing in gel next
- Loading branch information
Showing
17 changed files
with
92 additions
and
49 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
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
58 changes: 58 additions & 0 deletions
58
apps/site/src/components/component-blocks/symbols/symbols.component.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,58 @@ | ||
'use client'; | ||
|
||
import { Grid, Item } from '@westpac/ui/grid'; | ||
import { Input } from '@westpac/ui/input'; | ||
import * as AllLogos from '@westpac/ui/symbol'; | ||
import { ChangeEvent, useCallback, useMemo, useState } from 'react'; | ||
|
||
export const Symbols = () => { | ||
const [search, setSearch] = useState(''); | ||
|
||
const filteredSymbols = useMemo(() => { | ||
return Object.entries(AllLogos).reduce( | ||
(acc: { Logo: React.FC<AllLogos.SymbolProps>; key: string }[], [logoName, Logo]) => { | ||
if (logoName.toUpperCase().indexOf(search.toUpperCase()) === -1 || !logoName.includes('Symbol')) { | ||
return acc; | ||
} | ||
return [...acc, { key: logoName, Logo }]; | ||
}, | ||
[], | ||
); | ||
}, [search]); | ||
|
||
const foundText = filteredSymbols.length === 1 ? 'Found 1 symbol' : `Found ${filteredSymbols.length} symbols`; | ||
|
||
const handleOnChange = useCallback(({ target: { value } }: ChangeEvent<HTMLInputElement>) => { | ||
setSearch(value); | ||
}, []); | ||
|
||
return ( | ||
<div> | ||
<div className="bg-light mb-4 p-4"> | ||
<Grid> | ||
<Item span={{ initial: 12, sm: 6 }}> | ||
<div className="flex flex-col items-start sm:flex-row sm:items-center"> | ||
<label className="mb-2 mr-[1rem] sm:mb-0" htmlFor="filter-icons"> | ||
Filter by name | ||
</label> | ||
<Input id="filter-icon" value={search} onChange={handleOnChange} className="w-full" /> | ||
</div> | ||
</Item> | ||
</Grid> | ||
</div> | ||
<Grid> | ||
<Item span={12}> | ||
<p className="text-muted text-right italic">{foundText}</p> | ||
</Item> | ||
{filteredSymbols.map(({ key, Logo }) => ( | ||
<Item key={key} span={{ initial: 12, sm: 6, md: 4, lg: 3 }} className="flex"> | ||
<div className="xsl:mb-4 mb-2 flex grow flex-col items-center justify-center bg-white px-2 pb-3 pt-6"> | ||
<Logo className="mb-6" /> | ||
<span className="text-muted text-[0.6875rem]">{key}</span> | ||
</div> | ||
</Item> | ||
))} | ||
</Grid> | ||
</div> | ||
); | ||
}; |
11 changes: 11 additions & 0 deletions
11
apps/site/src/components/component-blocks/symbols/symbols.preview.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,11 @@ | ||
import { NotEditable, component } from '@keystatic/core'; | ||
|
||
export const symbols = component({ | ||
preview: () => ( | ||
<NotEditable> | ||
<div>All Symbols</div> | ||
</NotEditable> | ||
), | ||
label: 'Symbols', | ||
schema: {}, | ||
}); |
48 changes: 1 addition & 47 deletions
48
.../site/src/content/design-system/components/symbol/design/third-party-symbols/content.mdoc
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,47 +1 @@ | ||
Filter by name | ||
|
||
Found 22 symbols | ||
|
||
AmericanExpressSymbol | ||
|
||
AppleStoreInverseSymbol | ||
|
||
AppleStoreSymbol | ||
|
||
BPayLandSymbol | ||
|
||
BPayPortSymbol | ||
|
||
FacebookSymbol | ||
|
||
GooglePlusSymbol | ||
|
||
GoogleStoreSymbol | ||
|
||
InstagramSymbol | ||
|
||
LinkedInSymbol | ||
|
||
MastercardAcceptedSymbol | ||
|
||
MastercardHorizontalSymbol | ||
|
||
MastercardSymbol | ||
|
||
MicrosoftStoreSymbol | ||
|
||
PayIDSymbol | ||
|
||
SlackSymbol | ||
|
||
TwitterSymbol | ||
|
||
VisaBlueSymbol | ||
|
||
VisaSymbol | ||
|
||
VisaWhiteSymbol | ||
|
||
YammerSymbol | ||
|
||
YouTubeSymbol | ||
{% symbols /%} |
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
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
1 change: 1 addition & 0 deletions
1
packages/ui/src/components/checkbox-group/checkbox-group.stories.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
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
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,3 +1,4 @@ | ||
/* eslint-disable no-console */ | ||
import fs from 'fs'; | ||
import path from 'path'; | ||
|
||
|