gatsby-theme-carbon 2.0.0-next.2 → 2.1.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/index.js +1 -0
- package/package.json +24 -23
- package/src/components/FourOhFour/FourOhFour.module.scss +4 -0
- package/src/components/Layout.js +2 -2
- package/src/components/MDXProvider/defaultComponents.js +2 -0
- package/src/components/MiniCard/MiniCard.js +3 -2
- package/src/components/PageTabs/PageTabs.module.scss +1 -1
- package/src/components/SquareCard/SquareCard.js +175 -0
- package/src/components/SquareCard/SquareCard.module.scss +172 -0
- package/src/components/SquareCard/index.js +3 -0
- package/src/components/Switcher/Switcher.js +3 -9
- package/src/util/hooks/useId.js +5 -1
package/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export { default as Aside } from './src/components/Aside';
|
|
|
13
13
|
export { default as FeatureCard } from './src/components/FeatureCard';
|
|
14
14
|
export { default as FourOhFour } from './src/components/FourOhFour';
|
|
15
15
|
export { default as ImageCard } from './src/components/ImageCard';
|
|
16
|
+
export { default as SquareCard } from './src/components/SquareCard';
|
|
16
17
|
export { Tabs, Tab } from './src/components/Tabs';
|
|
17
18
|
export { default as InlineNotification } from './src/components/InlineNotification';
|
|
18
19
|
// Homepage Template Components
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gatsby-theme-carbon",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"main": "index.js",
|
|
5
5
|
"author": "vpicone <vp@vincepic.one> (@vpicone)",
|
|
6
6
|
"repository": {
|
|
@@ -22,47 +22,48 @@
|
|
|
22
22
|
"react-dom": "^17.0.2"
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@babel/core": "^7.
|
|
26
|
-
"@carbon/elements": "^10.
|
|
27
|
-
"@carbon/icons-react": "^10.
|
|
28
|
-
"@carbon/
|
|
25
|
+
"@babel/core": "^7.14.6",
|
|
26
|
+
"@carbon/elements": "^10.38.0",
|
|
27
|
+
"@carbon/icons-react": "^10.35.0",
|
|
28
|
+
"@carbon/pictograms-react": "^11.14.0",
|
|
29
|
+
"@carbon/themes": "^10.38.0",
|
|
29
30
|
"@mdx-js/mdx": "^1.5.5",
|
|
30
31
|
"@mdx-js/react": "^1.5.5",
|
|
31
32
|
"@reach/router": "^1.2.1",
|
|
32
33
|
"@vimeo/player": "^2.9.1",
|
|
33
34
|
"beautiful-react-hooks": "^0.23.1",
|
|
34
|
-
"carbon-components": "^10.
|
|
35
|
-
"carbon-components-react": "^7.
|
|
35
|
+
"carbon-components": "^10.39.0",
|
|
36
|
+
"carbon-components-react": "^7.39.0",
|
|
36
37
|
"carbon-icons": "^7.0.7",
|
|
37
38
|
"classnames": "^2.2.6",
|
|
38
39
|
"copy-to-clipboard": "^3.2.0",
|
|
39
40
|
"focus-trap-react": "^8.4.2",
|
|
40
|
-
"gatsby-plugin-catch-links": "^3.
|
|
41
|
+
"gatsby-plugin-catch-links": "^3.7.1",
|
|
41
42
|
"gatsby-plugin-lunr": "^1.5.2",
|
|
42
|
-
"gatsby-plugin-manifest": "^3.
|
|
43
|
-
"gatsby-plugin-mdx": "^2.
|
|
44
|
-
"gatsby-plugin-offline": "^4.
|
|
45
|
-
"gatsby-plugin-react-helmet": "^4.
|
|
46
|
-
"gatsby-plugin-sass": "^4.
|
|
43
|
+
"gatsby-plugin-manifest": "^3.7.1",
|
|
44
|
+
"gatsby-plugin-mdx": "^2.7.1",
|
|
45
|
+
"gatsby-plugin-offline": "^4.7.1",
|
|
46
|
+
"gatsby-plugin-react-helmet": "^4.7.1",
|
|
47
|
+
"gatsby-plugin-sass": "^4.7.1",
|
|
47
48
|
"gatsby-plugin-sass-resources": "^2.0.0",
|
|
48
|
-
"gatsby-plugin-sharp": "^3.
|
|
49
|
+
"gatsby-plugin-sharp": "^3.7.1",
|
|
49
50
|
"gatsby-plugin-webpack-bundle-analyser-v2": "^1.1.22",
|
|
50
|
-
"gatsby-remark-copy-linked-files": "^4.
|
|
51
|
-
"gatsby-remark-images": "^5.
|
|
52
|
-
"gatsby-remark-responsive-iframe": "^4.
|
|
53
|
-
"gatsby-remark-smartypants": "^4.
|
|
51
|
+
"gatsby-remark-copy-linked-files": "^4.4.1",
|
|
52
|
+
"gatsby-remark-images": "^5.4.1",
|
|
53
|
+
"gatsby-remark-responsive-iframe": "^4.4.1",
|
|
54
|
+
"gatsby-remark-smartypants": "^4.4.1",
|
|
54
55
|
"gatsby-remark-unwrap-images": "^1.0.1",
|
|
55
|
-
"gatsby-source-filesystem": "^3.
|
|
56
|
+
"gatsby-source-filesystem": "^3.7.1",
|
|
56
57
|
"gatsby-source-medium-feed": "^1.0.6",
|
|
57
|
-
"gatsby-transformer-yaml": "^3.
|
|
58
|
+
"gatsby-transformer-yaml": "^3.7.1",
|
|
58
59
|
"lodash.startcase": "^4.4.0",
|
|
59
60
|
"lodash.throttle": "^4.1.1",
|
|
60
61
|
"mkdirp": "^1.0.3",
|
|
61
|
-
"node-sass": "
|
|
62
|
-
"prism-react-renderer": "^1.
|
|
62
|
+
"node-sass": "5",
|
|
63
|
+
"prism-react-renderer": "^1.2.1",
|
|
63
64
|
"prop-types": "^15.7.2",
|
|
64
65
|
"react-helmet": "^6.0.0-beta",
|
|
65
|
-
"react-transition-group": "^4.
|
|
66
|
+
"react-transition-group": "^4.4.2",
|
|
66
67
|
"react-use": "^15.3.4",
|
|
67
68
|
"remark-slug": "^6.0.0",
|
|
68
69
|
"slugify": "^1.3.4",
|
package/src/components/Layout.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/* eslint-disable import/no-unresolved */
|
|
2
|
-
import React, {
|
|
2
|
+
import React, { useEffect } from 'react';
|
|
3
3
|
|
|
4
4
|
import Meta from './Meta';
|
|
5
5
|
import LeftNav from './LeftNav';
|
|
@@ -24,7 +24,7 @@ const Layout = ({
|
|
|
24
24
|
const is404 = children.key === null;
|
|
25
25
|
const { isSwitcherEnabled } = useMetadata();
|
|
26
26
|
|
|
27
|
-
|
|
27
|
+
useEffect(() => {
|
|
28
28
|
// eslint-disable-next-line global-require
|
|
29
29
|
const scroll = require('smooth-scroll')('a[href*="#"]', {
|
|
30
30
|
speed: 400,
|
|
@@ -30,6 +30,7 @@ import Title from '../Title';
|
|
|
30
30
|
import { MiniCard, CardGroup } from '../MiniCard';
|
|
31
31
|
import Sup from '../markdown/Sup';
|
|
32
32
|
import Abbr from '../markdown/Abbr';
|
|
33
|
+
import SquareCard from '../SquareCard';
|
|
33
34
|
|
|
34
35
|
const components = {
|
|
35
36
|
wrapper: function Wrapper({ children, ...props }) {
|
|
@@ -81,6 +82,7 @@ const components = {
|
|
|
81
82
|
Title,
|
|
82
83
|
MiniCard,
|
|
83
84
|
CardGroup,
|
|
85
|
+
SquareCard,
|
|
84
86
|
};
|
|
85
87
|
|
|
86
88
|
export default components;
|
|
@@ -36,6 +36,7 @@ const MiniCard = ({
|
|
|
36
36
|
title,
|
|
37
37
|
actionIcon,
|
|
38
38
|
className,
|
|
39
|
+
linkProps,
|
|
39
40
|
...rest
|
|
40
41
|
}) => {
|
|
41
42
|
const cardContent = (
|
|
@@ -57,11 +58,11 @@ const MiniCard = ({
|
|
|
57
58
|
}
|
|
58
59
|
|
|
59
60
|
const cardContainer = isLink ? (
|
|
60
|
-
<Link to={href} className={`${prefix}--tile--clickable`}>
|
|
61
|
+
<Link to={href} className={`${prefix}--tile--clickable`} {...linkProps}>
|
|
61
62
|
{cardContent}
|
|
62
63
|
</Link>
|
|
63
64
|
) : (
|
|
64
|
-
<a href={href} className={`${prefix}--tile--clickable`}>
|
|
65
|
+
<a href={href} className={`${prefix}--tile--clickable`} {...linkProps}>
|
|
65
66
|
{cardContent}
|
|
66
67
|
</a>
|
|
67
68
|
);
|
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import cx from 'classnames';
|
|
4
|
+
import { Link, withPrefix } from 'gatsby';
|
|
5
|
+
import {
|
|
6
|
+
Launch20,
|
|
7
|
+
Download20,
|
|
8
|
+
ArrowRight20,
|
|
9
|
+
Error20,
|
|
10
|
+
Email20,
|
|
11
|
+
} from '@carbon/icons-react';
|
|
12
|
+
import { settings } from 'carbon-components';
|
|
13
|
+
import { Column } from '../Grid';
|
|
14
|
+
import * as styles from './SquareCard.module.scss';
|
|
15
|
+
|
|
16
|
+
const { prefix } = settings;
|
|
17
|
+
|
|
18
|
+
export default class SquareCard extends React.Component {
|
|
19
|
+
render() {
|
|
20
|
+
const {
|
|
21
|
+
children,
|
|
22
|
+
href,
|
|
23
|
+
title,
|
|
24
|
+
smallTitle,
|
|
25
|
+
disabled,
|
|
26
|
+
bodyText,
|
|
27
|
+
helperText,
|
|
28
|
+
className,
|
|
29
|
+
actionIcon,
|
|
30
|
+
color,
|
|
31
|
+
...rest
|
|
32
|
+
} = this.props;
|
|
33
|
+
|
|
34
|
+
let isLink;
|
|
35
|
+
if (href !== undefined) {
|
|
36
|
+
isLink = href.charAt(0) === '/';
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const SquareCardClassNames = cx(className, styles.squareCard, {
|
|
40
|
+
[styles.disabled]: disabled,
|
|
41
|
+
[styles.darkMode]: color === 'dark',
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
const SquareCardTitleClassNames = cx(className, styles.title, {
|
|
45
|
+
[styles.titleSmall]: smallTitle,
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
const carbonTileclassNames = cx(
|
|
49
|
+
[`${prefix}--tile`],
|
|
50
|
+
[`${prefix}--tile--clickable`]
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
const aspectRatioClassNames = cx(
|
|
54
|
+
`${prefix}--aspect-ratio`,
|
|
55
|
+
`${prefix}--aspect-ratio--1x1`
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
const cardContent = (
|
|
59
|
+
<>
|
|
60
|
+
<h2 className={SquareCardTitleClassNames}>{title}</h2>
|
|
61
|
+
{bodyText ? <p className={styles.body}>{bodyText}</p> : null}
|
|
62
|
+
{helperText ? <p className={styles.helperText}>{helperText}</p> : null}
|
|
63
|
+
{children ? <div className={styles.helperIcon}>{children}</div> : null}
|
|
64
|
+
<div className={styles.actionIcon}>
|
|
65
|
+
{actionIcon === 'arrowRight' && !disabled ? (
|
|
66
|
+
<ArrowRight20 aria-label="Open resource" />
|
|
67
|
+
) : null}
|
|
68
|
+
{actionIcon === 'launch' && !disabled ? (
|
|
69
|
+
<Launch20 aria-label="Open resource" />
|
|
70
|
+
) : null}
|
|
71
|
+
{actionIcon === 'download' && !disabled ? (
|
|
72
|
+
<Download20 aria-label="Download" />
|
|
73
|
+
) : null}
|
|
74
|
+
{actionIcon === 'email' && !disabled ? (
|
|
75
|
+
<Email20 aria-label="Email" />
|
|
76
|
+
) : null}
|
|
77
|
+
{actionIcon === 'disabled' || disabled === true ? (
|
|
78
|
+
<Error20 aria-label="disabled" />
|
|
79
|
+
) : null}
|
|
80
|
+
</div>
|
|
81
|
+
</>
|
|
82
|
+
);
|
|
83
|
+
|
|
84
|
+
let cardContainer;
|
|
85
|
+
if (disabled === true) {
|
|
86
|
+
cardContainer = <div className={carbonTileclassNames}>{cardContent}</div>;
|
|
87
|
+
} else if (isLink === true) {
|
|
88
|
+
cardContainer = (
|
|
89
|
+
<Link to={href} className={carbonTileclassNames} {...rest}>
|
|
90
|
+
{cardContent}
|
|
91
|
+
</Link>
|
|
92
|
+
);
|
|
93
|
+
} else {
|
|
94
|
+
cardContainer = (
|
|
95
|
+
<a href={href} className={carbonTileclassNames} {...rest}>
|
|
96
|
+
{cardContent}
|
|
97
|
+
</a>
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return (
|
|
102
|
+
<Column
|
|
103
|
+
colMd={4}
|
|
104
|
+
colLg={4}
|
|
105
|
+
noGutterSm
|
|
106
|
+
className={SquareCardClassNames}
|
|
107
|
+
{...rest}>
|
|
108
|
+
<div className={aspectRatioClassNames}>
|
|
109
|
+
<div className={`${prefix}--aspect-ratio--object`}>
|
|
110
|
+
{cardContainer}
|
|
111
|
+
</div>
|
|
112
|
+
</div>
|
|
113
|
+
</Column>
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
SquareCard.propTypes = {
|
|
119
|
+
/**
|
|
120
|
+
* Use to set a pictogram
|
|
121
|
+
*/
|
|
122
|
+
children: PropTypes.node,
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Set url for card
|
|
126
|
+
*/
|
|
127
|
+
href: PropTypes.string,
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Large heading
|
|
131
|
+
*/
|
|
132
|
+
title: PropTypes.string,
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Use to enable the smaller heading
|
|
136
|
+
*/
|
|
137
|
+
smallTitle: PropTypes.bool,
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* Action icon, default is Arrow Right, options are Launch, ArrowRight, Download, Error
|
|
141
|
+
*/
|
|
142
|
+
actionIcon: PropTypes.string,
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* Use for disabled card
|
|
146
|
+
*/
|
|
147
|
+
disabled: PropTypes.bool,
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* Body text
|
|
151
|
+
*/
|
|
152
|
+
bodyText: PropTypes.string,
|
|
153
|
+
|
|
154
|
+
/**
|
|
155
|
+
* Helper text
|
|
156
|
+
*/
|
|
157
|
+
helperText: PropTypes.string,
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* set to "dark" for dark background card
|
|
161
|
+
*/
|
|
162
|
+
color: PropTypes.string,
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Specify a custom class
|
|
166
|
+
*/
|
|
167
|
+
className: PropTypes.string,
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
SquareCard.defaultProps = {
|
|
171
|
+
color: 'light',
|
|
172
|
+
disabled: false,
|
|
173
|
+
smallTitle: false,
|
|
174
|
+
actionIcon: 'arrowRight',
|
|
175
|
+
};
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
// Square Card Group
|
|
2
|
+
:global(.square-card-group) > * {
|
|
3
|
+
margin-bottom: 0;
|
|
4
|
+
}
|
|
5
|
+
.squareCard {
|
|
6
|
+
//overrides global vertical spacing
|
|
7
|
+
--space: 0;
|
|
8
|
+
border-top: 1px solid #e0e0e0;
|
|
9
|
+
border-left: 1px solid transparent;
|
|
10
|
+
|
|
11
|
+
@include carbon--breakpoint('md') {
|
|
12
|
+
border-left: 1px solid #e0e0e0;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
:global(.square-card-group) .squareCard:first-child {
|
|
17
|
+
border-top: 0 solid transparent;
|
|
18
|
+
}
|
|
19
|
+
:global(.square-card-group) .squareCard:nth-child(2) {
|
|
20
|
+
@include carbon--breakpoint('md') {
|
|
21
|
+
border-top: 0 solid transparent;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
:global(.square-card-group) .squareCard:nth-child(3) {
|
|
25
|
+
@include carbon--breakpoint('lg') {
|
|
26
|
+
border-top: 0 solid transparent;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
:global(.square-card-group) .squareCard:nth-child(2n + 1) {
|
|
30
|
+
@include carbon--breakpoint('md') {
|
|
31
|
+
border-left: 1px solid transparent;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
@include carbon--breakpoint('lg') {
|
|
35
|
+
border-left: 1px solid #e0e0e0;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
:global(.square-card-group) .squareCard:nth-child(3n + 1) {
|
|
39
|
+
@include carbon--breakpoint('lg') {
|
|
40
|
+
border-left: 1px solid transparent;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.squareCard :global(.#{$prefix}--tile) {
|
|
45
|
+
height: 100%;
|
|
46
|
+
padding: $spacing-05 15% $spacing-05 $spacing-05;
|
|
47
|
+
position: relative;
|
|
48
|
+
text-decoration: none;
|
|
49
|
+
|
|
50
|
+
&::after {
|
|
51
|
+
position: absolute;
|
|
52
|
+
top: 0;
|
|
53
|
+
left: 0;
|
|
54
|
+
content: '';
|
|
55
|
+
width: calc(100% - 1px); // 1px to offset negative `left` positioning
|
|
56
|
+
height: calc(100% - 1px); // 1px to offset negative `top` positioning
|
|
57
|
+
outline: 3px solid transparent;
|
|
58
|
+
outline-offset: -3px;
|
|
59
|
+
transition: outline motion(standard, productive) $duration--fast-01;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.squareCard :global(.#{$prefix}--tile:focus) {
|
|
64
|
+
outline: none;
|
|
65
|
+
|
|
66
|
+
&::after {
|
|
67
|
+
outline: 3px solid $focus;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.title {
|
|
72
|
+
@include carbon--type-style('productive-heading-04');
|
|
73
|
+
|
|
74
|
+
text-decoration: none;
|
|
75
|
+
position: relative;
|
|
76
|
+
z-index: 1;
|
|
77
|
+
|
|
78
|
+
@include carbon--breakpoint-between('lg', 'xlg') {
|
|
79
|
+
@include carbon--type-style('productive-heading-03');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.titleSmall {
|
|
84
|
+
@include carbon--type-style('productive-heading-03');
|
|
85
|
+
|
|
86
|
+
@include carbon--breakpoint-between('lg', 'xlg') {
|
|
87
|
+
@include carbon--type-style('productive-heading-02');
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.body {
|
|
92
|
+
@include carbon--type-style('body-short-02');
|
|
93
|
+
|
|
94
|
+
padding-top: $spacing-05;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.titleSmall + .body {
|
|
98
|
+
@include carbon--breakpoint-between('lg', 'xlg') {
|
|
99
|
+
padding-top: 0;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.helperText {
|
|
104
|
+
@include carbon--type-style('body-short-01');
|
|
105
|
+
|
|
106
|
+
position: absolute;
|
|
107
|
+
bottom: 1rem;
|
|
108
|
+
left: 1rem;
|
|
109
|
+
display: flex;
|
|
110
|
+
align-items: flex-end;
|
|
111
|
+
padding-right: $spacing-07;
|
|
112
|
+
margin-right: $spacing-06;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.helperIcon {
|
|
116
|
+
position: absolute;
|
|
117
|
+
bottom: 1rem;
|
|
118
|
+
left: 1rem;
|
|
119
|
+
min-width: 32px;
|
|
120
|
+
min-height: 32px;
|
|
121
|
+
display: flex;
|
|
122
|
+
align-items: flex-end;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.actionIcon {
|
|
126
|
+
position: absolute;
|
|
127
|
+
bottom: 1rem;
|
|
128
|
+
right: 1rem;
|
|
129
|
+
width: 20px;
|
|
130
|
+
height: 20px;
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Dark
|
|
134
|
+
.darkMode :global(.#{$prefix}--tile) {
|
|
135
|
+
background: $carbon--gray-90; //$ui-background for gray 90 theme
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.darkMode :global(.#{$prefix}--tile:hover) {
|
|
139
|
+
background: $carbon--gray-80; //$hover-ui for gray 90 theme
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
.darkMode .title,
|
|
143
|
+
.darkMode .body,
|
|
144
|
+
.darkMode .helperText {
|
|
145
|
+
color: $text-04;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
.darkMode .actionIcon svg,
|
|
149
|
+
.darkMode .helperIcon svg {
|
|
150
|
+
fill: $carbon--gray-10;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// Disabled
|
|
154
|
+
.disabled {
|
|
155
|
+
cursor: not-allowed;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.disabled :global(.#{$prefix}--tile:hover) {
|
|
159
|
+
background: $ui-01;
|
|
160
|
+
cursor: not-allowed;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
.disabled .title,
|
|
164
|
+
.disabled .body,
|
|
165
|
+
.disabled .helperText {
|
|
166
|
+
color: $disabled-03;
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
.disabled .actionIcon svg,
|
|
170
|
+
.disabled .helperIcon svg {
|
|
171
|
+
fill: $disabled-02;
|
|
172
|
+
}
|
|
@@ -1,10 +1,4 @@
|
|
|
1
|
-
import React, {
|
|
2
|
-
useContext,
|
|
3
|
-
useRef,
|
|
4
|
-
useLayoutEffect,
|
|
5
|
-
useEffect,
|
|
6
|
-
useState,
|
|
7
|
-
} from 'react';
|
|
1
|
+
import React, { useContext, useRef, useEffect, useState } from 'react';
|
|
8
2
|
import cx from 'classnames';
|
|
9
3
|
import useMedia from 'use-media';
|
|
10
4
|
import { Locked16 } from '@carbon/icons-react';
|
|
@@ -32,7 +26,7 @@ const Switcher = ({ children }) => {
|
|
|
32
26
|
}, [toggleNavState]);
|
|
33
27
|
|
|
34
28
|
// calculate and update height
|
|
35
|
-
|
|
29
|
+
useEffect(() => {
|
|
36
30
|
if (switcherIsOpen) {
|
|
37
31
|
setHeight(listRef.current.offsetHeight + 40);
|
|
38
32
|
} else {
|
|
@@ -102,7 +96,7 @@ const DefaultChildren = () => (
|
|
|
102
96
|
<SwitcherLink href="https://www.carbondesignsystem.com/">
|
|
103
97
|
Carbon Design System
|
|
104
98
|
</SwitcherLink>
|
|
105
|
-
<SwitcherLink href="https://www.ibm.com/standards/
|
|
99
|
+
<SwitcherLink href="https://www.ibm.com/standards/carbon/">
|
|
106
100
|
Carbon for IBM.com
|
|
107
101
|
</SwitcherLink>
|
|
108
102
|
<SwitcherLink href="https://www.ibm.com/design/event/">
|
package/src/util/hooks/useId.js
CHANGED
|
@@ -5,6 +5,10 @@ let globalIndex = 0;
|
|
|
5
5
|
// eslint-disable-next-line no-plusplus
|
|
6
6
|
const genId = () => ++globalIndex;
|
|
7
7
|
|
|
8
|
+
// https://medium.com/@alexandereardon/uselayouteffect-and-ssr-192986cdcf7a
|
|
9
|
+
const useIsomorphicLayoutEffect =
|
|
10
|
+
typeof window !== 'undefined' ? useLayoutEffect : useEffect;
|
|
11
|
+
|
|
8
12
|
export const useId = (label) => {
|
|
9
13
|
/*
|
|
10
14
|
* If this instance isn't part of the initial render, we don't have to do the
|
|
@@ -14,7 +18,7 @@ export const useId = (label) => {
|
|
|
14
18
|
|
|
15
19
|
const [id, setId] = useState(initialId);
|
|
16
20
|
|
|
17
|
-
|
|
21
|
+
useIsomorphicLayoutEffect(() => {
|
|
18
22
|
if (id === null) {
|
|
19
23
|
/*
|
|
20
24
|
* Patch the ID after render. We do this in `useLayoutEffect` to avoid any
|