Skip to content

Commit ffa3874

Browse files
authored
docs(pages): add navigation footer (#3577)
* docs(Shorthand|Theming): rework docs to be more actual * remove extension * docs(pages): aff navigation footer
1 parent 909e077 commit ffa3874

File tree

9 files changed

+66
-30
lines changed

9 files changed

+66
-30
lines changed

docs/src/components/DocumentationPage/DocumentationPage.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
import PropTypes from 'prop-types'
22
import React from 'react'
33
import { withRouteData, withSiteData } from 'react-static'
4-
import { Container, Divider } from 'semantic-ui-react'
4+
import { Container, Divider, Header } from 'semantic-ui-react'
55

66
import DocsLayout from 'docs/src/components/DocsLayout'
77
import * as components from './components'
8+
import DocumentationPageFooter from './DocumentationPageFooter'
89

910
const DocumentationPage = ({ pageName, ...rest }) => {
1011
const { default: MarkdownComponent, meta } = require(`docs/src/pages/${pageName}`)
@@ -13,7 +14,9 @@ const DocumentationPage = ({ pageName, ...rest }) => {
1314
<DocsLayout additionalTitle={meta.title}>
1415
<Container text>
1516
<Divider hidden />
17+
<Header as='h1' content={meta.title} textAlign='center' />
1618
<MarkdownComponent {...rest} components={components} />
19+
<DocumentationPageFooter prevPage={meta.prevPage} nextPage={meta.nextPage} />
1720
<Divider hidden section />
1821
</Container>
1922
</DocsLayout>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
import PropTypes from 'prop-types'
2+
import React, { Fragment } from 'react'
3+
import { Link } from 'react-static'
4+
import { Divider, Grid, Header } from 'semantic-ui-react'
5+
6+
const DocumentationPageFooter = ({ nextPage, prevPage }) =>
7+
nextPage || prevPage ? (
8+
<Fragment>
9+
<Divider />
10+
11+
<Grid columns={2}>
12+
<Grid.Column>
13+
{prevPage && (
14+
<Header
15+
as={Link}
16+
content={prevPage.title}
17+
subheader='Previous page'
18+
to={prevPage.href}
19+
/>
20+
)}
21+
</Grid.Column>
22+
<Grid.Column textAlign='right'>
23+
{nextPage && (
24+
<Header as={Link} content={nextPage.title} subheader='Next page' to={nextPage.href} />
25+
)}
26+
</Grid.Column>
27+
</Grid>
28+
</Fragment>
29+
) : null
30+
31+
DocumentationPageFooter.propTypes = {
32+
nextPage: PropTypes.shape({ title: PropTypes.string, href: PropTypes.string }),
33+
prevPage: PropTypes.shape({ title: PropTypes.string, href: PropTypes.string }),
34+
}
35+
36+
export default DocumentationPageFooter

docs/src/pages/Augmentation.mdx

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { Header, Message } from 'semantic-ui-react'
1+
import { Message } from 'semantic-ui-react'
22

33
export const meta = {
44
title: 'Augmentation',
5+
prevPage: { title: 'Get Started', href: '/usage' },
6+
nextPage: { title: 'Shorthand Props', href: '/shorthand-props' },
57
}
68

7-
<Header as='h1' content='Augmentation' textAlign='center' />
8-
99
React components are inherently composable. Semantic UI React makes them even more so with the `as` prop feature: you can control the rendered HTML tag, or render one component as another component.
1010

1111
```jsx
@@ -25,7 +25,6 @@ Augmentation is powerful. You can compose component features and props without a
2525

2626
```jsx
2727
import { Link } from 'react-router-dom'
28-
2928
;<Menu>
3029
// 💡 `to` does not belong to `Menu.Item` props and will be passed to `Link`
3130
<Menu.Item as={Link} to='/home'>

docs/src/pages/Layouts.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ import { Card, Header } from 'semantic-ui-react'
33

44
export const meta = {
55
title: 'Layout examples',
6+
prevPage: { title: 'Theming', href: '/theming' },
7+
nextPage: { title: 'Prototypes', href: '/prototypes' },
68
}
79

8-
<Header as='h1' content='Layout examples' textAlign='center' />
9-
1010
<Header as='h2' content='Starter' subheader='Examples to introduce components and their function' />
1111

1212
<Card.Group stackable itemsPerRow='2'>

docs/src/pages/Prototypes.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@ import { Button, Card, Header, Image } from 'semantic-ui-react'
22

33
export const meta = {
44
title: 'Prototypes',
5+
prevPage: { title: 'Layout examples', href: '/layouts' },
56
}
67

7-
<Header as='h1' content='Prototypes' textAlign='center' />
8-
98
<Header as='h2' content='Integrations' subheader='Examples of integrations with other libraries' />
109

1110
<Card.Group stackable itemsPerRow='2'>

docs/src/pages/ShorthandProps.mdx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
import { Header, Icon, Message } from 'semantic-ui-react'
1+
import { Icon, Message } from 'semantic-ui-react'
22

33
export const meta = {
44
title: 'Shorthand Props',
5+
prevPage: { title: 'Augmentation', href: '/augmentation' },
6+
nextPage: { title: 'Theming', href: '/theming' },
57
}
68

7-
<Header as='h1' content='Shorthand Props' textAlign='center' />
8-
99
It is quite common for Semantic UI React component to have "shorthands" which accept shorthand values. For example, `Button` component has an `icon` shorthand which value defines the icon that will be rendered.
1010

1111
```jsx

docs/src/pages/Theming.mdx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { Button, Header, Message } from 'semantic-ui-react'
1+
import { Button, Message } from 'semantic-ui-react'
22

33
export const meta = {
44
title: 'Theming',
5+
prevPage: { title: 'Shorthand Props', href: '/shorthand-props' },
6+
nextPage: { title: 'Layout examples', href: '/layouts' },
57
}
68

7-
<Header as='h1' content='Theming' textAlign='center' />
8-
99
## Preface
1010

1111
Semantic UI React does not have own styling system and fully relies on the theming of
1212
Semantic UI. It's really powerful, you don't need to know LESS or CSS you can simply
1313
update values of variables or use styles from predefined themes.
14-
14+
1515
In fact, all you know about theming and styling of Semantic UI is fully applicable to Semantic UI React.
1616

1717
<Button
@@ -32,7 +32,7 @@ In fact, all you know about theming and styling of Semantic UI is fully applicab
3232
## Quick start
3333

3434
Semantic UI offers its own build system that uses Gulp and produces prepared CSS files.
35-
35+
3636
In all cases we recommend to use the LESS package and tune it into your build system with Webpack. The LESS package also does not depend on Gulp and other cruft things.
3737
However, this package is not friendly for Webpack and requires additional configuration.
3838

docs/src/pages/Usage.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,9 @@ import { semanticUIDocsURL, semanticUIRepoURL, semanticUICSSRepoURL } from 'docs
66

77
export const meta = {
88
title: 'Get Started',
9+
nextPage: { title: 'Augmentation', href: '/augmentation' },
910
}
1011

11-
# Get Started
12-
1312
## Install
1413

1514
Semantic UI React provides React components while Semantic UI provides themes as CSS stylesheets.

static.webpack.js

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,22 @@ export default (webpackConfig, { stage }) => ({
99
entry:
1010
stage === 'prod'
1111
? {
12-
main: [config.paths.docsSrc('index.js'), config.paths.src('index.js')],
13-
}
12+
main: [config.paths.docsSrc('index.js'), config.paths.src('index.js')],
13+
}
1414
: webpackConfig.entry,
1515
externals:
1616
stage === 'node'
1717
? webpackConfig.externals
1818
: {
19-
'anchor-js': 'AnchorJS',
20-
'@babel/standalone': 'Babel',
21-
faker: 'faker',
22-
'prettier/standalone': 'prettier',
23-
'prop-types': 'PropTypes',
24-
react: 'React',
25-
'react-dom': 'ReactDOM',
26-
'react-dom/server': 'ReactDOMServer',
27-
},
19+
'anchor-js': 'AnchorJS',
20+
'@babel/standalone': 'Babel',
21+
faker: 'faker',
22+
'prettier/standalone': 'prettier',
23+
'prop-types': 'PropTypes',
24+
react: 'React',
25+
'react-dom': 'ReactDOM',
26+
'react-dom/server': 'ReactDOMServer',
27+
},
2828
module: {
2929
...webpackConfig.module,
3030
rules: [

0 commit comments

Comments
 (0)