-
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 Header demo #DS-898
Header demo in web-react is now same as demo in web and web-twig
- Loading branch information
1 parent
53fc021
commit 7e99b36
Showing
7 changed files
with
152 additions
and
47 deletions.
There are no files selected for viewing
18 changes: 18 additions & 0 deletions
18
packages/web-react/src/components/Header/demo/HeaderExperimentalRTL.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,18 @@ | ||
import React from 'react'; | ||
import { Checkbox } from '../../Checkbox'; | ||
|
||
const HeaderExperimentalRTL = () => { | ||
const toggleRtl = () => { | ||
const htmlElement = document.querySelector('html'); | ||
|
||
if (htmlElement?.hasAttribute('dir')) { | ||
htmlElement?.removeAttribute('dir'); | ||
} else { | ||
htmlElement?.setAttribute('dir', 'rtl'); | ||
} | ||
}; | ||
|
||
return <Checkbox id="rtl" label="Switch writing mode to RTL" onChange={toggleRtl} />; | ||
}; | ||
|
||
export default HeaderExperimentalRTL; |
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
16 changes: 16 additions & 0 deletions
16
packages/web-react/src/components/Header/demo/HeaderMinimalInverted.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,16 @@ | ||
import React from 'react'; | ||
import { Link } from '../../Link'; | ||
import { Header } from '..'; | ||
import SpiritLogo from './SpiritLogo'; | ||
|
||
const HeaderMinimalInverted = () => { | ||
return ( | ||
<Header color="inverted"> | ||
<Link href="/"> | ||
<SpiritLogo /> | ||
</Link> | ||
</Header> | ||
); | ||
}; | ||
|
||
export default HeaderMinimalInverted; |
16 changes: 16 additions & 0 deletions
16
packages/web-react/src/components/Header/demo/HeaderSimpleInverted.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,16 @@ | ||
import React from 'react'; | ||
import { Link } from '../../Link'; | ||
import { Header } from '..'; | ||
import SpiritLogo from './SpiritLogo'; | ||
|
||
const HeaderSimpleInverted = () => { | ||
return ( | ||
<Header color="inverted" isSimple> | ||
<Link href="/"> | ||
<SpiritLogo /> | ||
</Link> | ||
</Header> | ||
); | ||
}; | ||
|
||
export default HeaderSimpleInverted; |
32 changes: 32 additions & 0 deletions
32
packages/web-react/src/components/Header/demo/HeaderSimpleTransparent.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,32 @@ | ||
import React from 'react'; | ||
import { Heading } from '../../Heading'; | ||
import { Link } from '../../Link'; | ||
import { Header } from '..'; | ||
import SpiritLogo from './SpiritLogo'; | ||
|
||
const HeaderSimpleTransparent = () => { | ||
return ( | ||
<div | ||
style={{ | ||
display: 'flex', | ||
flexDirection: 'column', | ||
justifyContent: 'space-between', | ||
height: '300px', | ||
color: 'white', | ||
background: 'linear-gradient(121.59deg, #073256 0%, #185C95 100%)', | ||
}} | ||
> | ||
<Header isSimple> | ||
<Link href="/"> | ||
<SpiritLogo /> | ||
</Link> | ||
</Header> | ||
|
||
<Heading elementType="div" size="large" UNSAFE_className="text-center mb-1200"> | ||
Example Cover | ||
</Heading> | ||
</div> | ||
); | ||
}; | ||
|
||
export default HeaderSimpleTransparent; |
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,20 +1,40 @@ | ||
// 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 DocsSection from '../../../../docs/DocsSections'; | ||
import Header from './Header'; | ||
import HeaderActions from './HeaderActions'; | ||
import HeaderActionsAndHeaderDialog from './HeaderActionsAndHeaderDialog'; | ||
import { IconsProvider } from '../../../context'; | ||
import HeaderMinimalInverted from './HeaderMinimalInverted'; | ||
import HeaderInvertedWithActions from './HeaderInvertedWithActions'; | ||
import HeaderInvertedWithActionsAndDialog from './HeaderInvertedWithActionsAndDialog'; | ||
import HeaderSimpleInverted from './HeaderSimpleInverted'; | ||
import HeaderSimpleTransparent from './HeaderSimpleTransparent'; | ||
import HeaderExperimentalRTL from './HeaderExperimentalRTL'; | ||
|
||
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render( | ||
<React.StrictMode> | ||
<DocsSection title="Default"> | ||
<Header {...Header.args} color="inverted" /> | ||
</DocsSection> | ||
<DocsSection title="Actions"> | ||
<HeaderActions /> | ||
</DocsSection> | ||
<DocsSection title="Actions And Header Dialog"> | ||
<HeaderActionsAndHeaderDialog /> | ||
</DocsSection> | ||
<IconsProvider value={icons}> | ||
<DocsSection title="Minimal Inverted Header"> | ||
<HeaderMinimalInverted /> | ||
</DocsSection> | ||
<DocsSection title="Inverted Header with Actions"> | ||
<HeaderInvertedWithActions /> | ||
</DocsSection> | ||
<DocsSection title="Inverted Header with Actions and Header Dialog"> | ||
<HeaderInvertedWithActionsAndDialog /> | ||
</DocsSection> | ||
<DocsSection title="Simple Inverted Header"> | ||
<HeaderSimpleInverted /> | ||
</DocsSection> | ||
<DocsSection title="Simple Transparent Header"> | ||
<HeaderSimpleTransparent /> | ||
</DocsSection> | ||
<DocsSection title="Experimental RTL Support"> | ||
<HeaderExperimentalRTL /> | ||
</DocsSection> | ||
</IconsProvider> | ||
</React.StrictMode>, | ||
); |