-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Docs(web-react): Add Icons demo #DS-900
- Add Components and Icons tabs - Create demo page for icons
- Loading branch information
1 parent
8b0255f
commit f45df2b
Showing
9 changed files
with
80 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
{{#> layout/default }} | ||
{{#> layout/default page="components" }} | ||
|
||
<section class="docs-Section"> | ||
|
||
|
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,16 @@ | ||
{{#> layout/default page="icons"}} | ||
|
||
<section class="docs-Section"> | ||
|
||
<h2 class="docs-Heading">Icons</h2> | ||
|
||
<div class="docs-Stack docs-Stack--start"> | ||
|
||
<div id="root"></div> | ||
<script type="module" src="./index.tsx"></script> | ||
|
||
</div> | ||
|
||
</section> | ||
|
||
{{/layout/default }} |
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 |
---|---|---|
|
@@ -5,6 +5,8 @@ | |
<main class="py-900 py-tablet-1200"> | ||
<div class="Container"> | ||
|
||
{{> tabs }} | ||
|
||
{{> @partial-block }} | ||
|
||
</div> | ||
|
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,8 @@ | ||
<ul class="Tabs mb-1100" role="tablist"> | ||
<li class="Tabs__item"> | ||
<a href="/" class="Tabs__link{{#if (eq page 'components')}} is-selected" aria-selected="true{{/if}}">Components</a> | ||
</li> | ||
<li class="Tabs__item"> | ||
<a href="/src/icons/" class="Tabs__link{{#if (eq page 'icons')}} is-selected" aria-selected="true{{/if}}">Icons</a> | ||
</li> | ||
</ul> |
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,27 @@ | ||
import React, { useContext } from 'react'; | ||
import { Grid, Text, Icon } from '../../components'; | ||
import IconsContext, { IconsContextType } from '../../context/IconsContext'; | ||
|
||
const Icons = () => { | ||
let icons; | ||
const iconsContext: IconsContextType = useContext(IconsContext); | ||
|
||
if (iconsContext !== null && iconsContext !== undefined) { | ||
icons = Object.keys(iconsContext); | ||
} | ||
|
||
return ( | ||
<Grid elementType="ul" cols={2} tablet={4} desktop={6} UNSAFE_className="text-center my-1000 list-unstyled"> | ||
{icons?.map((icon) => ( | ||
<li key={icon} className="mb-600"> | ||
<Icon name={icon} /> | ||
<Text UNSAFE_className="mt-500" emphasis="bold"> | ||
{icon} | ||
</Text> | ||
</li> | ||
))} | ||
</Grid> | ||
); | ||
}; | ||
|
||
export default Icons; |
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 @@ | ||
{{> icons }} |
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,17 @@ | ||
// Because there is no `dist` directory during the CI run | ||
/* eslint-disable import/no-extraneous-dependencies, import/extensions, import/no-unresolved */ | ||
import React from 'react'; | ||
import ReactDOM from 'react-dom/client'; | ||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment, import/extensions, import/no-unresolved | ||
// @ts-ignore: No declaration file | ||
import icons from '@lmc-eu/spirit-icons/dist/icons'; | ||
import { IconsProvider } from '../context'; | ||
import Icons from './demo/icons'; | ||
|
||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( | ||
<React.StrictMode> | ||
<IconsProvider value={icons}> | ||
<Icons /> | ||
</IconsProvider> | ||
</React.StrictMode>, | ||
); |