-
Notifications
You must be signed in to change notification settings - Fork 212
Expand file tree
/
Copy pathindex.jsx
More file actions
68 lines (63 loc) · 1.92 KB
/
index.jsx
File metadata and controls
68 lines (63 loc) · 1.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
/*
* Copyright (c) 2021, salesforce.com, inc.
* All rights reserved.
* SPDX-License-Identifier: BSD-3-Clause
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/
import React from 'react'
import PropTypes from 'prop-types'
import {Box, Heading, Stack, Text, Container} from '@chakra-ui/react'
/**
* Section component used on content pages like home page.
* This component helps with creating a consistent layout and
* consistent typography styles for section headings.
*/
const Section = ({title, subtitle, actions, maxWidth, children, ...props}) => {
const sectionMaxWidth = maxWidth || '3xl'
return (
<Box as="section" paddingBottom="16" {...props}>
<Stack gap={6} as={Container} maxW={sectionMaxWidth} textAlign="center">
{title && (
<Heading as="h2" fontSize={40} textAlign="center">
{title}
</Heading>
)}
{subtitle && (
<Text color="gray.700" fontWeight={600}>
{subtitle}
</Text>
)}
{actions && (
<Box paddingTop="2" width={{base: 'full', md: 'auto'}}>
{actions}
</Box>
)}
</Stack>
{children}
</Box>
)
}
Section.displayName = 'Section'
Section.propTypes = {
/**
* Section component main title
*/
title: PropTypes.string,
/**
* Section component subtitle
*/
subtitle: PropTypes.oneOfType([PropTypes.array, PropTypes.string, PropTypes.node]),
/**
* Section children node(s)
*/
children: PropTypes.node,
/**
* Call to action component(s)
*/
actions: PropTypes.element,
/**
* Section maximum width
*/
maxWidth: PropTypes.string
}
export default Section