@cloudflare/component-page 4.2.511 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/PageHeader.js DELETED
@@ -1,67 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
- var _styleContainer = require("@cloudflare/style-container");
13
-
14
- var _componentLabel = require("@cloudflare/component-label");
15
-
16
- var _intlReact = require("@cloudflare/intl-react");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- var PageHeading = (0, _styleContainer.createComponent)(function (_ref) {
21
- var theme = _ref.theme;
22
- return {
23
- fontSize: theme.fontSizes[6],
24
- marginTop: theme.space[0],
25
- marginBottom: theme.space[0],
26
- lineHeight: 1.25,
27
- fontWeight: 600
28
- };
29
- }, 'h1');
30
- var PageSubheading = (0, _styleContainer.createComponent)(function (_ref2) {
31
- var theme = _ref2.theme;
32
- return {
33
- fontSize: theme.fontSizes[4],
34
- marginTop: theme.space[0],
35
- marginBottom: theme.space[0],
36
- lineHeight: 1.25,
37
- color: theme.colors.gray[3],
38
- fontWeight: 400
39
- };
40
- }, 'h2');
41
- var Beta = (0, _styleContainer.createComponent)(function (_ref3) {
42
- var theme = _ref3.theme;
43
- return {
44
- marginLeft: theme.space[2],
45
- verticalAlign: 'middle'
46
- };
47
- }, _componentLabel.Label);
48
-
49
- var PageHeader = function PageHeader(_ref4) {
50
- var title = _ref4.title,
51
- subtitle = _ref4.subtitle,
52
- beta = _ref4.beta;
53
- return /*#__PURE__*/_react.default.createElement("header", null, /*#__PURE__*/_react.default.createElement(PageHeading, null, title, beta && /*#__PURE__*/_react.default.createElement(Beta, {
54
- hue: "orange"
55
- }, /*#__PURE__*/_react.default.createElement(_intlReact.Trans, {
56
- _: "Beta",
57
- id: "common.beta"
58
- }))), subtitle && /*#__PURE__*/_react.default.createElement(PageSubheading, null, subtitle));
59
- };
60
-
61
- PageHeader.propTypes = {
62
- title: _propTypes.default.node.isRequired,
63
- subtitle: _propTypes.default.node,
64
- beta: _propTypes.default.bool
65
- };
66
- var _default = PageHeader;
67
- exports.default = _default;
@@ -1,34 +0,0 @@
1
- import React from 'react';
2
- import { createComponent } from '@cloudflare/style-container';
3
-
4
- type PageWidth = 'narrow' | 'wide' | 'unbounded';
5
-
6
- const maxWidthByType = {
7
- narrow: '64em',
8
- wide: '79em',
9
- unbounded: '100%'
10
- };
11
-
12
- const styles = ({ type = 'wide' }: { type?: PageWidth }) => ({
13
- marginLeft: 'auto',
14
- marginRight: 'auto',
15
- width: type === 'unbounded' ? '100%' : '90%',
16
- maxWidth: maxWidthByType[type] || maxWidthByType.narrow
17
- });
18
-
19
- type Props = {
20
- children?: any;
21
- className?: string;
22
- testId?: string;
23
- type?: PageWidth;
24
- };
25
-
26
- const PageContent: React.FC<Props> = ({ className, children, testId }) => {
27
- return (
28
- <div className={className} data-testid={testId}>
29
- {children}
30
- </div>
31
- );
32
- };
33
-
34
- export default createComponent(styles, PageContent);
@@ -1,66 +0,0 @@
1
- import React from 'react';
2
- import PropTypes from 'prop-types';
3
- import { createComponent } from '@cloudflare/style-container';
4
- import { Label } from '@cloudflare/component-label';
5
- import { Trans } from '@cloudflare/intl-react';
6
-
7
- const PageHeading = createComponent(
8
- ({ theme }) => ({
9
- fontSize: theme.fontSizes[6],
10
- marginTop: theme.space[0],
11
- marginBottom: theme.space[0],
12
- lineHeight: 1.25,
13
- fontWeight: 600
14
- }),
15
- 'h1'
16
- );
17
-
18
- const PageSubheading = createComponent(
19
- ({ theme }) => ({
20
- fontSize: theme.fontSizes[4],
21
- marginTop: theme.space[0],
22
- marginBottom: theme.space[0],
23
- lineHeight: 1.25,
24
- color: theme.colors.gray[3],
25
- fontWeight: 400
26
- }),
27
- 'h2'
28
- );
29
-
30
- const Beta = createComponent(
31
- ({ theme }) => ({
32
- marginLeft: theme.space[2],
33
- verticalAlign: 'middle'
34
- }),
35
- Label
36
- );
37
-
38
- type Props = {
39
- title: React.ReactNode;
40
- subtitle?: React.ReactNode;
41
- beta?: boolean;
42
- };
43
-
44
- const PageHeader: React.FC<Props> = ({ title, subtitle, beta }) => {
45
- return (
46
- <header>
47
- <PageHeading>
48
- {title}
49
- {beta && (
50
- <Beta hue="orange">
51
- <Trans _="Beta" id="common.beta" />
52
- </Beta>
53
- )}
54
- </PageHeading>
55
- {subtitle && <PageSubheading>{subtitle}</PageSubheading>}
56
- </header>
57
- );
58
- };
59
-
60
- PageHeader.propTypes = {
61
- title: PropTypes.node.isRequired,
62
- subtitle: PropTypes.node,
63
- beta: PropTypes.bool
64
- };
65
-
66
- export default PageHeader;