Skip to content

Commit

Permalink
resolve conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
Irinaristova committed Apr 27, 2021
2 parents 80e5418 + 2b74b94 commit ed24e68
Show file tree
Hide file tree
Showing 24 changed files with 552 additions and 176 deletions.
58 changes: 35 additions & 23 deletions src/lib/box-styles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,15 @@ import styled from 'styled-components';
export const Global = styled.div`
--palette-snow-1000: #000000;
--palette-snow-500: #c0c0c0;
--palette-snow-300: #e5e5e5;
--palette-snow-100: #f5f5f5;
--palette-snow-0: #ffffff;
--palette-lavender-500: #9381f1;
--palette-lavender-300: #b0a3f4;
--palette-lavender-100: #c9c0f8;
--palette-dawn-300: #ff9097;
/* should be rewritten to formulas */
--woly-line-height: 24px;
Expand All @@ -18,14 +24,15 @@ export const Global = styled.div`
--woly-main-level: 3;
--woly-neutral: var(--palette-snow-500);
--woly-focus: #9381f1;
--woly-background: #ffffff;
--woly-focus: var(--palette-lavender-500);
--woly-background: var(--palette-snow-0);
--woly-danger: var(--palette-dawn-300);
[data-variant='primary'] {
--woly-shape-default: #b0a3f4;
--woly-shape-disabled: #e5e5e5;
--woly-shape-hover: #c9c0f8;
--woly-shape-active: var(--palette-lavender-500);
--woly-shape-default: var(--palette-lavender-300);
--woly-shape-disabled: var(--palette-snow-300);
--woly-shape-hover: var(--palette-lavender-100);
--woly-shape-active: var(--palette-lavender-300);
--woly-shape-text-default: var(--palette-snow-0);
--woly-shape-text-disabled: var(--palette-snow-0);
Expand Down Expand Up @@ -59,24 +66,29 @@ export const Global = styled.div`
--woly-background-disabled: #c0c0c0;
--woly-border-disabled: #c0c0c0;
--woly-color-disabled: #a39bb2;
--woly-label-color: #ffffff;
--woly-text-disabled: #e4e4e4;
--woly-fill-disabled: #e4e4e4;
}
[data-variant='error'] {
--woly-border-width: 1.5px;
[data-variant='danger'] {
--woly-shape-default: var(--woly-danger);
--woly-shape-disabled: var(--palette-snow-300);
--woly-shape-hover: var(--woly-danger);
--woly-shape-active: var(--woly-danger);
--woly-background: #ffffff;
--woly-border: #eb5656;
--woly-color: #eb5656;
--woly-label-color: #eb5656;
--woly-canvas: #eb5656;
--woly-border-focus: #eb5656;
--woly-error-text: #eb5656;
--woly-hint-color: #ff9097;
--woly-background-disabled: #c0c0c0;
--woly-border-disabled: #c0c0c0;
--woly-color-disabled: #a39bb2;
--woly-shape-text-default: var(--palette-snow-0);
--woly-shape-text-disabled: var(--palette-snow-0);
--woly-shape-text-hover: var(--palette-snow-0);
--woly-shape-text-active: var(--palette-snow-0);
--woly-canvas-default: transparent;
--woly-canvas-disabled: var(--palette-snow-100);
--woly-canvas-hover: var(--woly-danger);
--woly-canvas-active: var(--woly-danger);
--woly-canvas-text-default: var(--woly-danger);
--woly-canvas-text-disabled: var(--palette-snow-500);
--woly-canvas-text-hover: var(--woly-danger);
--woly-canvas-text-active: var(--woly-danger);
}
`;

Expand Down
1 change: 1 addition & 0 deletions src/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
export { positionRelativeGet } from './position-relative';
export { keyboardEventHandle } from './keyboard-event';
export { keyHandlerGet } from './select-handlers';
export { Variant } from './types';
19 changes: 12 additions & 7 deletions src/ui/atoms/header-panel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ export const HeaderPanel = styled.div.attrs(map)`
height: 100%;
width: 100%;
padding: var(--woly-padding, 12px);
--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)
);
background-color: var(--woly-canvas, #ffffff);
border-color: var(--woly-border, #000000);
border-style: solid;
border-width: var(--woly-border-width, 0);
border-radius: var(--woly-rounding, 3px);
box-shadow: var(--woly-box-shadow, 3px 3px 9px rgba(57, 57, 57, 0.12));
--local-box-shadow: 3px 3px 9px rgba(57, 57, 57, 0.12);
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(--local-box-shadow);
`;
11 changes: 3 additions & 8 deletions src/ui/atoms/heading/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,6 @@
import * as React from 'react';
import styled, { StyledComponent } from 'styled-components';
import { Variant } from 'lib/types';

/**
* --woly-font-size
* --woly-label-color
* --woly-line-height
*/

interface HeadingProps extends React.LabelHTMLAttributes<HTMLLabelElement> {
children: React.ReactNode;
size?: 1 | 2 | 3;
Expand All @@ -21,7 +14,9 @@ const map = (properties: HeadingProps & Variant) => ({
});

export const Heading = styled.span.attrs(map)`
color: var(--woly-color, #000000);
--local-color: var(--woly-canvas-text-default);
color: var(--local-color);
font-size: 24px;
line-height: 30px;
font-weight: 500;
Expand Down
2 changes: 2 additions & 0 deletions src/ui/atoms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export { Input } from './input';
export { Label } from './label';
export { List } from './list';
export { Notification } from './notification';
export { Separator } from './separator';
export { Surface } from './surface';
export { Table, Thead, Tbody, Tr, Td, Th } from './table';
export { Text } from './text';
export { TextArea } from './text-area';
export { Tooltip } from './tooltip';
5 changes: 1 addition & 4 deletions src/ui/atoms/input/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,14 @@ Primary and secondary variants are should be used to focus user attention.

Error variant can be used to focus user attention on error.

<!-- example will be fixed with task FRNT-477 -->

<Playground>
<Input
leftIcon={<InfoIcon />}
name="name"
onChange={(event) => console.info('On input change')}
placeholder="Error input"
type="text"
value="Error"
variant="Error"
variant="danger"
/>
</Playground>

Expand Down
10 changes: 6 additions & 4 deletions src/ui/atoms/label/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,14 @@ const map = (properties: LabelProps & Variant) => ({
});

export const Label = styled.label.attrs(map)`
--vertical: calc(1px * var(--woly-component-level) * var(--woly-main-level));
--horizontal: calc(var(--woly-const-m) + (1px * var(--woly-main-level)) + var(--vertical));
--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));
padding: var(--woly-vertical, 6px) var(--woly-horizontal, 6px);
--local-color: var(--woly-canvas-text-default);
color: var(--woly-label-color, #000000);
padding: var(--local-vertical) var(--local-horizontal);
color: var(--local-color);
font-size: var(--woly-font-size, 15px);
line-height: var(--woly-line-height, 24px);
` as StyledComponent<'label', Record<string, unknown>, LabelProps & Variant>;
2 changes: 1 addition & 1 deletion src/ui/atoms/label/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ This increased hit area provides an advantage to anyone trying to activate the i
Error variant can be used to focus user attention on error.

<Playground>
<Label variant="error">Error label</Label>
<Label variant="danger">Error label</Label>
</Playground>

### Kinds
Expand Down
21 changes: 21 additions & 0 deletions src/ui/atoms/separator/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import * as React from 'react';
import styled, { StyledComponent } from 'styled-components';
import { Variant } from 'lib/types';

const SeparatorBase: React.FC<{ className: string } & Variant> = ({ className, variant }) => (
<div className={className} data-variant={variant}>
<div data-line></div>
</div>
);

export const Separator = styled(SeparatorBase)`
--local-padding: 3px;
width: 100%;
padding: calc(var(--local-padding) - (var(--woly-border-width) / 2)) 0;
[data-line] {
height: var(--woly-border-width);
background: var(--woly-canvas-disabled);
}
` as StyledComponent<'div', Record<string, unknown>, Variant>;
43 changes: 43 additions & 0 deletions src/ui/atoms/separator/usage.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
name: separator
category: atoms
package: 'woly'
---

import { Playground, block } from 'box-styles'
import { Heading, Input, Separator } from 'ui'

`Sepatator` is a line that divides blocks or content.

### Example

<Playground direction="vertical">
<div style={{ width: '300px' }}>
<div style={{ margin: '18px 0' }}>
<Heading size={2}>User List</Heading>
</div>
<Separator variant="primary" />
<div style={{ margin: '18px 0' }}>
<Input
type="text"
name="name"
placeholder="Search"
onChange={() => console.info('On input change')}
variant="primary"
style={{ margin: '10px 0' }}
/>
</div>
</div>
</Playground>

### Kinds

| Name | Description |
| ----------- | -------------- |
| `Separator` | Base separator |

### Props

| Name | Type | Default | Description |
| --------- | -------- | ----------- | ----------------------------------------- |
| `variant` | `string` | `'default'` | Variant prop to style Separator component |
48 changes: 48 additions & 0 deletions src/ui/atoms/table/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import styled from 'styled-components';
import { Variant } from 'lib/types';

const map = (properties: { columns: number } & Variant) => ({
'data-variant': properties.variant || 'default',
style: { '--local-columns': properties.columns },
});

export const Table = styled.table.attrs(map)`
--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)
);
--local-cell-max-width: 240px;
--local-gap: calc(var(--woly-const-m) / 2);
display: grid;
gap: var(--local-gap);
grid-template-columns: repeat(var(--local-columns), auto);
`;

export const Thead = styled.thead`
display: contents;
`;

export const Tbody = styled.tbody`
display: contents;
`;

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);
color: var(--woly-canvas-text-disabled);
`;

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);
color: var(--woly-canvas-text-default);
`;

export const Tr = styled.tr`
display: contents;
`;
Loading

0 comments on commit ed24e68

Please sign in to comment.