Skip to content
This repository has been archived by the owner on Jul 28, 2024. It is now read-only.

Commit

Permalink
style: reformat code and styles
Browse files Browse the repository at this point in the history
  • Loading branch information
sergeysova committed May 7, 2021
1 parent fc64241 commit a828adf
Show file tree
Hide file tree
Showing 26 changed files with 196 additions and 140 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
run: yarn build

- name: Check for formatting
run: yarn format:validate
run: yarn format

- name: Check for code style
run: yarn lint:code
Expand Down
4 changes: 2 additions & 2 deletions .stylelintrc.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
{
"processors": ["stylelint-processor-styled-components"],
"extends": [
"stylelint-config-recommended",
"stylelint-config-styled-components",
Expand All @@ -11,6 +10,7 @@
{
"empty-line-between-groups": true
}
]
],
"no-descending-specificity": null
}
}
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@
"build": "rm -rf dist && node build",
"commit": "git-cz",
"docs:build": "gatsby clean && gatsby build --prefix-paths",
"format": "prettier --write '{src,build,.storybook,packages}/**/**.{ts,tsx,js,md,mdx,json}'",
"format:validate": "prettier --check '{src,build,.storybook,packages}/**/**.{ts,tsx,js,md,mdx,json}'",
"format": "prettier --check '{src,build,.storybook,packages}/**/**.{ts,tsx,js,md,mdx,json}'",
"format:fix": "prettier --write '{src,build,.storybook,packages}/**/**.{ts,tsx,js,md,mdx,json}'",
"lint:code": "eslint --ext .ts,.tsx src",
"lint:code:fix": "yarn lint:code --fix",
"lint:style": "stylelint ./src/**/*.{js,css,ts,tsx}",
"lint:style": "stylelint './src/**/*.{js,css,ts,tsx}'",
"percy:cypress": "percy exec -- cypress run",
"start": "gatsby clean && gatsby develop",
"test:visual": "start-server-and-test 'yarn start' http://localhost:8000/package/woly/component/button 'yarn percy:cypress'",
Expand Down
5 changes: 3 additions & 2 deletions src/ui/atoms/backdrop/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import styled from 'styled-components';

export const Backdrop = styled.div`
position: fixed;
left: 0;
top: 0;
bottom: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.3);
`;
16 changes: 10 additions & 6 deletions src/ui/atoms/button-icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,33 +24,33 @@ const ButtonIconBase: React.FC<Props & Variant> = ({

export const ButtonIcon = styled(ButtonIconBase)`
${box}
--local-vertical: calc(
1px * var(--woly-component-level) * var(--woly-main-level)
);
--local-vertical: calc(1px * var(--woly-component-level) * var(--woly-main-level));
--local-shape-color: var(--woly-canvas-default);
--local-icon-size: calc(var(--woly-line-height));
--local-button-size: calc(var(--local-icon-size) + (var(--local-vertical) * 2));
--local-icon-color: var(--woly-shape-default);
display: flex;
justify-content: center;
align-items: center;
justify-content: center;
box-sizing: border-box;
width: var(--local-button-size);
height: var(--local-button-size);
background: var(--local-shape-color);
border: var(--woly-border-width) solid var(--local-shape-color);
border-radius: var(--woly-rounding);
cursor: pointer;
background: var(--local-shape-color);
outline: none;
cursor: pointer;
[data-icon] {
display: flex;
align-items: center;
justify-content: center;
svg {
width: var(--local-icon-size);
height: var(--local-icon-size);
Expand All @@ -59,6 +59,7 @@ export const ButtonIcon = styled(ButtonIconBase)`
svg > path {
fill: var(--local-icon-color);
}
svg > g {
stroke: var(--local-icon-color);
}
Expand All @@ -71,13 +72,16 @@ export const ButtonIcon = styled(ButtonIconBase)`
&:active {
--local-shape-color: var(--woly-focus);
}
&:focus {
--local-shape-color: var(--woly-shape-active);
box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus);
}
&:hover {
--local-shape-color: var(--woly-shape-hover);
}
&:disabled {
--local-shape-color: var(--woly-canvas-disabled);
}
Expand Down
8 changes: 5 additions & 3 deletions src/ui/atoms/button/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,14 @@ export const Button = styled(ButtonBase)`
--local-shape-color: var(--woly-shape-default);
--local-border-color: var(--woly-shape-default);
${box};
${box}
box-sizing: border-box;
display: flex;
flex-wrap: nowrap;
justify-content: center;
box-sizing: border-box;
color: var(--local-text-color);
font-size: var(--woly-font-size);
line-height: var(--woly-line-height);
Expand All @@ -60,9 +61,10 @@ export const Button = styled(ButtonBase)`
outline: none;
&[data-outlined='true'] {
background-color: transparent;
color: var(--local-shape-color);
background-color: transparent;
svg > path {
fill: var(--local-shape-color);
}
Expand Down
15 changes: 9 additions & 6 deletions src/ui/atoms/chip/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,25 +54,28 @@ export const Chip = styled(ChipBase)`
--local-color: var(--woly-shape-text-default);
--local-border-color: var(--woly-shape-default);
box-sizing: border-box;
display: flex;
align-items: center;
background-color: var(--local-background);
box-sizing: border-box;
color: var(--local-color);
border-radius: var(--woly-rounding);
font-size: var(--woly-font-size);
outline: none;
background-color: var(--local-background);
border: var(--woly-border-width) solid var(--local-border-color);
border-radius: var(--woly-rounding);
outline: none;
[data-text] {
outline: none;
line-height: var(--woly-line-height);
outline: none;
}
&[role='button']:focus-within {
--local-background: var(--woly-focus);
--local-border-color: var(--woly-shape-active);
box-shadow: 0 0 0 var(--woly-border-width) var(--woly-shape-default);
}
Expand Down
12 changes: 6 additions & 6 deletions src/ui/atoms/header-panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@ const map = (properties: Variant) => ({
export const HeaderPanel = styled.div.attrs(map)`
display: flex;
align-items: center;
height: 100%;
width: 100%;
--local-vertical: calc(1px * var(--woly-component-level) * var(--woly-main-level));
--local-horizontal: calc(
var(--woly-const-m) + (1px * var(--woly-main-level)) + var(--local-vertical)
);
height: 100%;
padding: var(--local-vertical) var(--local-horizontal);
background-color: var(--woly-background);
border: var(--woly-border-width) solid var(--woly-background);
border-radius: var(--woly-rounding);
box-shadow: var(--woly-shadow);
--local-vertical: calc(1px * var(--woly-component-level) * var(--woly-main-level));
--local-horizontal: calc(
var(--woly-const-m) + (1px * var(--woly-main-level)) + var(--local-vertical)
);
` as StyledComponent<'div', Record<string, unknown>, Variant>;
2 changes: 1 addition & 1 deletion src/ui/atoms/heading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ export const Heading = styled.span.attrs(map)`
--local-color: var(--woly-canvas-text-default);
color: var(--local-color);
font-weight: 500;
font-size: 24px;
line-height: 30px;
font-weight: 500;
&[data-size='2'] {
font-size: 21px;
line-height: 27px;
Expand Down
14 changes: 8 additions & 6 deletions src/ui/atoms/list/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ export const ListContainer = styled.div.attrs(mapContainer)`
display: grid;
grid-template-columns: 1fr;
gap: var(--local-gap);
background-color: var(--woly-shape-text-default);
padding: 0;
margin: 0;
padding: 0;
background-color: var(--woly-shape-text-default);
` as StyledComponent<'div', Record<string, unknown>, Variant>;

export const ListItem: React.FC<ListItemProps & ListElementsProps & Variant> = ({
Expand Down Expand Up @@ -67,17 +68,18 @@ const ListItemContainer = styled.div.attrs(mapItem)`
${box}
--local-icon-color: var(--woly-canvas-text-default);
--local-backgound: var(--woly-canvas-default);
--local-color: var(--woly-canvas-text-default)
--local-color: var(--woly-canvas-text-default);
cursor: pointer;
color: var(--local-color);
font-size: var(--woly-font-size);
line-height: var(--woly-line-height);
text-decoration: none;
background-color: var(--local-backgound);
color: var(--local-color);
list-style-type: none;
background-color: var(--local-backgound);
cursor: pointer;
span {
svg > path {
fill: var(--local-icon-color);
Expand Down
1 change: 1 addition & 0 deletions src/ui/atoms/separator/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export const Separator = styled(SeparatorBase)`
[data-line] {
height: var(--woly-border-width);
background: var(--woly-canvas-disabled);
}
` as StyledComponent<'div', Record<string, unknown>, Variant>;
18 changes: 11 additions & 7 deletions src/ui/atoms/table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ export const Table = styled.table.attrs(map)`
--local-gap: calc(var(--woly-const-m) / 2);
display: grid;
gap: var(--local-gap);
grid-template-columns: repeat(var(--local-columns), auto);
gap: var(--local-gap);
`;

export const Thead = styled.thead`
Expand All @@ -28,19 +28,23 @@ export const Tbody = styled.tbody`
`;

export const Th = styled.th`
padding: var(--local-vertical) var(--local-horizontal);
max-width: var(--local-cell-max-width);
box-sizing: border-box;
background: var(--woly-shape-text-default);
max-width: var(--local-cell-max-width);
padding: var(--local-vertical) var(--local-horizontal);
color: var(--woly-canvas-text-disabled);
background: var(--woly-shape-text-default);
`;

export const Td = styled.td`
padding: var(--local-vertical) var(--local-horizontal);
max-width: var(--local-cell-max-width);
box-sizing: border-box;
background: var(--woly-shape-text-default);
max-width: var(--local-cell-max-width);
padding: var(--local-vertical) var(--local-horizontal);
color: var(--woly-canvas-text-default);
background: var(--woly-shape-text-default);
`;

export const Tr = styled.tr`
Expand Down
17 changes: 10 additions & 7 deletions src/ui/atoms/text-area/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,26 +85,29 @@ export const TextArea = styled(TextAreaBase)`
--local-border-color: var(--woly-canvas-text-hover);
--local-background-color: var(--woly-canvas-default);
--local-value-color: var(--woly-canvas-text-default);
box-sizing: border-box;
width: 100%;
box-sizing: border-box;
outline: none;
font-size: var(--woly-font-size, 15px);
line-height: var(--woly-line-height, 21px);
outline: none;
textarea {
padding: var(--local-vertical) var(--local-horizontal);
outline: none;
overflow: hidden;
background-color: var(--local-background-color);
color: var(--local-value-color);
background-color: var(--local-background-color);
border: var(--woly-border-width) solid var(--local-border-color);
border-radius: var(--woly-rounding);
overflow: hidden;
outline: none;
resize: none;
&::placeholder {
Expand All @@ -114,14 +117,14 @@ export const TextArea = styled(TextAreaBase)`
&:focus > textarea {
--local-border-color: var(--woly-focus);
box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus);
outline: none;
box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus);
}
&:active > textarea {
--local-border-color: var(--woly-focus);
box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus);
outline: none;
box-shadow: 0 0 0 var(--woly-border-width) var(--woly-focus);
}
&:hover > textarea {
Expand Down
5 changes: 3 additions & 2 deletions src/ui/atoms/text/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ export const Text = styled.p.attrs(map)`
--local-color: var(--woly-canvas-text-default);
margin: 0;
color: var(--local-color);
font-weight: 400;
font-size: 15px;
line-height: 21px;
font-weight: 400;
&[data-type='subtitle'][data-weight='medium'] {
font-weight: 500;
Expand All @@ -48,9 +49,9 @@ export const Text = styled.p.attrs(map)`
}
&[data-type='hint'] {
color: var(--local-color);
font-size: 12px;
line-height: 15px;
color: var(--local-color);
}
&[data-type='hint'][data-weight='light'] {
Expand Down
Loading

0 comments on commit a828adf

Please sign in to comment.