-
Notifications
You must be signed in to change notification settings - Fork 78
docs: add header, footer and toc to storybook #1007
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f71ee05
custom header + footer
jbadan 072ef3c
match colors to spec
jbadan bd34801
move components into folder
jbadan 99a8d94
add header and footer to docs
jbadan c2f3b3a
scss
jbadan 76ef517
header on overview page
jbadan 628298f
we need css too
jbadan eecd44a
toc bot
jbadan ebcf475
remove usestate
jbadan 788814e
move containers inside
jbadan 46b03aa
remove padding + fix link
jbadan dd6a568
add target blank to community links
jbadan 611da04
toc highlight
jbadan 9775841
absolute
jbadan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,31 @@ | ||
| import React from 'react'; | ||
|
|
||
| const Community = () => { | ||
| return ( | ||
| <div className='fr-community'> | ||
| <section> | ||
| <h4>Libraries</h4> | ||
| <ul> | ||
| <li><a href='https://sap.github.io/fundamental-styles/' target='_blank'>Fundamental Library <strong>Styles</strong></a></li> | ||
| <li><a href='https://sap.github.io/fundamental-ngx/' target='_blank'>Fundamental Library for <strong>Angular</strong></a></li> | ||
| <li><a href='https://sap.github.io/fundamental-react/' target='_blank'>Fundamental Library for <strong>React</strong></a></li> | ||
| <li><a href='https://sap.github.io/fundamental-vue/' target='_blank'>Fundamental Library for <strong>Vue</strong></a></li> | ||
| </ul> | ||
| </section> | ||
| <section> | ||
| <h4>Community</h4> | ||
| <ul> | ||
| <li><a href='https://github.com/sap/fundamental-styles' target='_blank'><img src='./assets/github.png' alt='github logo'/>github.com/sap/fundamental-styles</a></li> | ||
| <li><a href='https://twitter.com/fundamental_lib' target='_blank'><img src='./assets/twitter.png' alt='twitter logo'/>twitter.com/fundamental_lib</a></li> | ||
| <li><a href='https://join.slack.com/t/ui-fundamentals/shared_invite/enQtNTIzOTU0Mzc2NTc5LWQzZWI5MWFhYjE5OTc4YzliN2JhOTc1ZjQxZTg1YjZiMWZiYzRkNjMwYzgyMmFkYmNhZDVjMWE5MDIzOWEzMmM' target='_blank'> | ||
| <img src='./assets/slack.png' alt='slack logo'/>ui-fundamentals-slack.com</a></li> | ||
| <li><a href='https://www.linkedin.com/company/sap-graph/' target='_blank'><img src='./assets/linkedin.png' alt='linkedin logo'/>linkedin.com/company/sap-graph/</a></li> | ||
| </ul> | ||
| </section> | ||
| </div> | ||
| ) | ||
| } | ||
|
|
||
| Community.displayName = 'Community'; | ||
|
|
||
| export default Community; |
This file contains hidden or 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,56 @@ | ||
| import '../custom.scss'; | ||
| import Community from './Community'; | ||
| import Footer from './Footer'; | ||
| import Header from './Header'; | ||
| import Import from './Import'; | ||
| import Toc from './Toc'; | ||
| import tocbot from 'tocbot'; | ||
| import React, { useEffect } from 'react'; | ||
| import { | ||
| Title, | ||
| Subtitle, | ||
| Description, | ||
| Primary, | ||
| Props, | ||
| Stories, | ||
| } from '@storybook/addon-docs/blocks'; | ||
|
|
||
| const DocsPage = () => { | ||
|
|
||
| useEffect(() => { | ||
| tocbot.init( | ||
| { | ||
| tocSelector: '.js-toc', | ||
| contentSelector: '.sbdocs-wrapper', | ||
| headingSelector: 'h2.sbdocs-h2, h3.sbdocs-h3, h4.sbdocs-h4', | ||
| orderedList: true, | ||
| collapseDepth: 3, | ||
| hasInnerContainers: true | ||
| } | ||
| ); | ||
| document.querySelectorAll('.toc-link').forEach( x => x.setAttribute('target','_self')); | ||
| }, []); | ||
|
|
||
| return ( | ||
| <> | ||
| <Header /> | ||
| <Title /> | ||
| <Toc /> | ||
| <div className='fr-docs-container'> | ||
| <Subtitle /> | ||
| <Import /> | ||
| <Description /> | ||
| <Primary /> | ||
| <Stories /> | ||
| <h2 className='sbdocs-h2' id='properties'>Properties</h2> | ||
| <Props /> | ||
| <Community /> | ||
| <Footer /> | ||
| </div> | ||
| </> | ||
| ) | ||
| } | ||
|
|
||
| DocsPage.displayName = 'DocsPage'; | ||
|
|
||
| export default DocsPage; | ||
This file contains hidden or 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,26 @@ | ||
| import React from 'react'; | ||
|
|
||
| const Footer = () => { | ||
| return ( | ||
| <footer className='fr-footer'> | ||
| <section className='fr-footer--left'> | ||
| <span className='fr-footer__slogan'>THE BEST RUN</span> | ||
| <img | ||
| src='./assets/sap.png' | ||
| alt='SAP logo' | ||
| height='16' /> | ||
| <p className='fr-footer__copyright'>© Copyright SAP {`${new Date().getFullYear()}`}</p> | ||
| </section> | ||
| <section className='fr-footer--right'> | ||
| <a href='https://www.sap.com/about/legal/privacy.html' target='_blank'>Privacy</a> | ||
| <a href='https://www.sap.com/about/legal/impressum.html' target='_blank'>Legal Disclosure</a> | ||
| <a href='https://www.sap.com/about/legal/copyright.html' target='_blank'>Copyright and Trademarks</a> | ||
| <a href='https://www.sap.com/corporate/en/legal/terms-of-use.html' target='_blank'>Terms of Use</a> | ||
| </section> | ||
| </footer> | ||
| ) | ||
| } | ||
|
|
||
| Footer.displayName = 'Footer'; | ||
|
|
||
| export default Footer; |
This file contains hidden or 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,31 @@ | ||
| import packageJson from '../../../package.json'; | ||
| import React from 'react'; | ||
|
|
||
| const Header = () => { | ||
| return ( | ||
| <header className='fr-header'> | ||
| <section className='fr-header--left'> | ||
| <span>Fundamental React</span> | ||
| </section> | ||
| <section className='fr-header--right'> | ||
| <a className='fr-header__anchor' href='https://github.com/SAP/fundamental-react' | ||
| target='_blank'> | ||
| <svg viewBox='0 0 512 499.36' xmlns='http://www.w3.org/2000/svg'> | ||
| <title>GitHub</title> | ||
| <path d='M256 0C114.64 0 0 114.61 0 256c0 113.09 73.34 209 175.08 242.9 12.8 2.35 17.47-5.56 17.47-12.34 0-6.08-.22-22.18-.35-43.54-71.2 15.49-86.2-34.34-86.2-34.34-11.64-29.57-28.42-37.45-28.42-37.45-23.27-15.84 1.73-15.55 1.73-15.55 25.69 1.81 39.21 26.38 39.21 26.38 22.84 39.12 59.92 27.82 74.5 21.27 2.33-16.54 8.94-27.82 16.25-34.22-56.84-6.43-116.6-28.43-116.6-126.49 0-27.95 10-50.8 26.35-68.69-2.63-6.48-11.42-32.5 2.51-67.75 0 0 21.49-6.88 70.4 26.24a242.65 242.65 0 0 1 128.18 0c48.87-33.13 70.33-26.24 70.33-26.24 14 35.25 5.18 61.27 2.55 67.75 16.41 17.9 26.31 40.75 26.31 68.69 0 98.35-59.85 120-116.88 126.32 9.19 7.9 17.38 23.53 17.38 47.41 0 34.22-.31 61.83-.31 70.23 0 6.85 4.61 14.81 17.6 12.31C438.72 464.97 512 369.08 512 256.02 512 114.62 397.37 0 256 0z' fill='#404040' | ||
| fillRule='evenodd' /> | ||
| </svg> | ||
| </a> | ||
| <a | ||
| className='fr-header__anchor' | ||
| href={`https://github.com/SAP/fundamental-react/tree/v${packageJson.version}`} | ||
| target='_blank'> | ||
| {`v${packageJson.version}`} | ||
| </a> | ||
| </section> | ||
| </header>) | ||
| } | ||
|
|
||
| Header.displayName = 'Header'; | ||
|
|
||
| export default Header; |
1 change: 0 additions & 1 deletion
1
.storybook/custom/Import.js → .storybook/custom/components/Import.js
This file contains hidden or 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 hidden or 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,15 @@ | ||
| import '../toc.scss'; | ||
| import React from 'react'; | ||
|
|
||
| const Toc = () => { | ||
| return ( | ||
| <> | ||
| <h2 className='toc-heading'>Contents</h2> | ||
| <nav className='js-toc toc' /> | ||
| </> | ||
| ) | ||
| } | ||
|
|
||
| Toc.displayName = 'Toc'; | ||
|
|
||
| export default Toc; |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is ugly - can anyone think of another way to do this? It doesn't look like the tocbot api allows adding additional attributes.
It's also not updating the active class (blue left border) as you scroll
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed