Skip to content

Commit 95e4f85

Browse files
feat(www): refactor insights pages and add packages (#10282)
* feat(www): update pages and add packages pages * chore(www): lint styles * refactor(www): update insights page * chore(www): add eslintrc for www * chore(www): remove log from Flex component * chore(www): update with stylelint fixes Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
1 parent 8b01d69 commit 95e4f85

File tree

23 files changed

+1520
-341
lines changed

23 files changed

+1520
-341
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Code generated by @carbon/react. DO NOT EDIT.
2+
//
3+
// Copyright IBM Corp. 2018, 2018
4+
//
5+
// This source code is licensed under the Apache-2.0 license found in the
6+
// LICENSE file in the root directory of this source tree.
7+
//
8+
9+
@forward '@carbon/styles/scss/layer';

packages/carbon-react/tasks/build-styles.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ async function build() {
3535
type: 'file',
3636
filepath: '_grid.scss',
3737
},
38+
{
39+
type: 'file',
40+
filepath: '_layer.scss',
41+
},
3842
{
3943
type: 'file',
4044
filepath: '_motion.scss',

www/.eslintrc.js

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
/**
2+
* Copyright IBM Corp. 2018, 2018
3+
*
4+
* This source code is licensed under the Apache-2.0 license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
'use strict';
9+
10+
module.exports = {
11+
extends: [require.resolve('../config/eslint-config-carbon/internal.js')],
12+
rules: {
13+
'jsx-a11y/anchor-is-valid': 'off',
14+
'react/prop-types': 'off',
15+
'react/react-in-jsx-scope': 'off',
16+
},
17+
};

www/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
"sass": "^1.43.4"
3838
},
3939
"devDependencies": {
40-
"rimraf": "^3.0.2"
40+
"fast-glob": "^3.2.7",
41+
"lodash.merge": "^4.6.2",
42+
"rimraf": "^3.0.2",
43+
"semver": "^7.3.5"
4144
}
4245
}
Lines changed: 141 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,141 @@
1+
//
2+
// Copyright IBM Corp. 2016, 2018
3+
//
4+
// This source code is licensed under the Apache-2.0 license found in the
5+
// LICENSE file in the root directory of this source tree.
6+
//
7+
8+
@use 'sass:string';
9+
@use '@carbon/react/scss/spacing';
10+
11+
// Padding
12+
$index: 1;
13+
14+
.p0 {
15+
padding: 0;
16+
}
17+
18+
.px-0 {
19+
padding-right: 0;
20+
padding-left: 0;
21+
}
22+
23+
.py-0 {
24+
padding-top: 0;
25+
padding-bottom: 0;
26+
}
27+
28+
.pl-0 {
29+
padding-left: 0;
30+
}
31+
32+
.pr-0 {
33+
padding-right: 0;
34+
}
35+
36+
.pt-0 {
37+
padding-top: 0;
38+
}
39+
40+
.pb-0 {
41+
padding-bottom: 0;
42+
}
43+
44+
@each $key, $value in spacing.$spacing {
45+
.p#{$index} {
46+
padding: $value;
47+
}
48+
49+
.px-#{$index} {
50+
padding-right: $value;
51+
padding-left: $value;
52+
}
53+
54+
.py-#{$index} {
55+
padding-top: $value;
56+
padding-bottom: $value;
57+
}
58+
59+
.pl-#{$index} {
60+
padding-left: $value;
61+
}
62+
63+
.pr-#{$index} {
64+
padding-right: $value;
65+
}
66+
67+
.pt-#{$index} {
68+
padding-top: $value;
69+
}
70+
71+
.pb-#{$index} {
72+
padding-bottom: $value;
73+
}
74+
$index: $index + 1;
75+
}
76+
77+
// Margin
78+
$index: 1;
79+
80+
.m0 {
81+
margin: 0;
82+
}
83+
84+
.mx-0 {
85+
margin-right: 0;
86+
margin-left: 0;
87+
}
88+
89+
.my-0 {
90+
margin-top: 0;
91+
margin-bottom: 0;
92+
}
93+
94+
.ml-0 {
95+
margin-left: 0;
96+
}
97+
98+
.mr-0 {
99+
margin-right: 0;
100+
}
101+
102+
.mt-0 {
103+
margin-top: 0;
104+
}
105+
106+
.mb-0 {
107+
margin-bottom: 0;
108+
}
109+
110+
@each $key, $value in spacing.$spacing {
111+
.m#{$index} {
112+
margin: $value;
113+
}
114+
115+
.mx-#{$index} {
116+
margin-right: $value;
117+
margin-left: $value;
118+
}
119+
120+
.my-#{$index} {
121+
margin-top: $value;
122+
margin-bottom: $value;
123+
}
124+
125+
.ml-#{$index} {
126+
margin-left: $value;
127+
}
128+
129+
.mr-#{$index} {
130+
margin-right: $value;
131+
}
132+
133+
.mt-#{$index} {
134+
margin-top: $value;
135+
}
136+
137+
.mb-#{$index} {
138+
margin-bottom: $value;
139+
}
140+
$index: $index + 1;
141+
}

www/src/components/Box/index.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/**
2+
* Copyright IBM Corp. 2016, 2018
3+
*
4+
* This source code is licensed under the Apache-2.0 license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
import * as classes from './Box.module.scss';
9+
10+
import cx from 'clsx';
11+
import React from 'react';
12+
13+
const keys = Object.keys(classes);
14+
15+
function Box({ children, ...rest }) {
16+
const child = React.Children.only(children);
17+
const childProps = {};
18+
const tokens = keys.filter((key) => {
19+
if (rest[key]) {
20+
return true;
21+
}
22+
childProps[key] = rest[key];
23+
return false;
24+
});
25+
const className = cx(
26+
tokens.map((token) => {
27+
return classes[token];
28+
})
29+
);
30+
return React.cloneElement(child, {
31+
...childProps,
32+
className: cx(child.props.className, className),
33+
});
34+
}
35+
36+
export { Box };
Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
//
2+
// Copyright IBM Corp. 2016, 2018
3+
//
4+
// This source code is licensed under the Apache-2.0 license found in the
5+
// LICENSE file in the root directory of this source tree.
6+
//
7+
8+
@use '@carbon/react/scss/spacing';
9+
10+
.flex {
11+
display: flex;
12+
}
13+
14+
/// https://tailwindcss.com/docs/flex-wrap
15+
.wrap {
16+
flex-wrap: wrap;
17+
}
18+
19+
.wrap-reverse {
20+
flex-wrap: wrap-reverse;
21+
}
22+
23+
.nowrap {
24+
flex-wrap: nowrap;
25+
}
26+
27+
/// https://tailwindcss.com/docs/flex-direction
28+
.row {
29+
flex-direction: row;
30+
}
31+
32+
.row-reverse {
33+
flex-direction: row-reverse;
34+
}
35+
36+
.col {
37+
flex-direction: column;
38+
}
39+
40+
.col-reverse {
41+
flex-direction: column-reverse;
42+
}
43+
44+
/// https://tailwindcss.com/docs/gap
45+
.gap-0 {
46+
gap: 0;
47+
}
48+
49+
.gap-x-0 {
50+
column-gap: 0;
51+
}
52+
53+
.gap-y-0 {
54+
row-gap: 0;
55+
}
56+
57+
$index: 1;
58+
59+
@each $key, $value in spacing.$spacing {
60+
.gap-#{$index} {
61+
gap: $value;
62+
}
63+
64+
.gap-x-#{$index} {
65+
column-gap: $value;
66+
}
67+
68+
.gap-y-#{$index} {
69+
row-gap: $value;
70+
}
71+
72+
$index: $index + 1;
73+
}
74+
75+
/// https://tailwindcss.com/docs/justify-content
76+
.justify-start {
77+
justify-content: flex-start;
78+
}
79+
80+
.justify-end {
81+
justify-content: flex-end;
82+
}
83+
84+
.justify-center {
85+
justify-content: flex-center;
86+
}
87+
88+
.justify-between {
89+
justify-content: space-between;
90+
}
91+
92+
.justify-around {
93+
justify-content: space-around;
94+
}
95+
96+
.justify-evenly {
97+
justify-content: space-evenly;
98+
}
99+
100+
/// https://tailwindcss.com/docs/align-items
101+
.align-start {
102+
align-items: flex-start;
103+
}
104+
105+
.align-end {
106+
align-items: flex-end;
107+
}
108+
109+
.align-center {
110+
align-items: center;
111+
}

www/src/components/Flex/index.js

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
/**
2+
* Copyright IBM Corp. 2016, 2018
3+
*
4+
* This source code is licensed under the Apache-2.0 license found in the
5+
* LICENSE file in the root directory of this source tree.
6+
*/
7+
8+
import * as classes from './Flex.module.scss';
9+
10+
import cx from 'clsx';
11+
import React from 'react';
12+
import { Box } from '../Box';
13+
14+
function Flex({ as: BaseComponent = 'div', children, ...rest }) {
15+
const childProps = {};
16+
const utilityClasses = Object.keys(rest).filter((key) => {
17+
if (classes[key]) {
18+
return true;
19+
}
20+
childProps[key] = rest[key];
21+
return false;
22+
});
23+
const className = cx(
24+
classes.flex,
25+
utilityClasses.map((key) => {
26+
return classes[key];
27+
})
28+
);
29+
30+
return (
31+
<Box {...childProps}>
32+
<BaseComponent className={className}>{children}</BaseComponent>
33+
</Box>
34+
);
35+
}
36+
37+
export { Flex };

0 commit comments

Comments
 (0)