Files: 90f1fa10f4cf1eadad9cd3539872fd71cc183030 / components / section.js
725 bytesRaw
1 | import Link from 'next/link'; |
2 | import { string, element } from 'prop-types'; |
3 | |
4 | const Section = ({ title, href, children }) => ( |
5 | <section className="section"> |
6 | <h1> |
7 | { |
8 | href && ( |
9 | <Link href={ href }> |
10 | <a title={ title }>{ title }</a> |
11 | </Link> |
12 | ) |
13 | } |
14 | { |
15 | !href && title |
16 | } |
17 | </h1> |
18 | { children } |
19 | |
20 | <style jsx global>{` |
21 | .section { |
22 | margin: 15px auto; |
23 | } |
24 | .section h1 { |
25 | margin-bottom: 15px; |
26 | } |
27 | .section h1, |
28 | .section h1 a { |
29 | font-size: 26px; |
30 | } |
31 | `}</style> |
32 | </section> |
33 | ); |
34 | |
35 | Section.propTypes = { |
36 | title: string, |
37 | href: string, |
38 | children: element.isRequired |
39 | }; |
40 | |
41 | export default Section; |
Built with git-ssb-web