-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8 from CSSSR/CORE-29
CORE-29
- Loading branch information
Showing
33 changed files
with
1,004 additions
and
966 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
20 changes: 20 additions & 0 deletions
20
examples/nextjs-integration/components/docs/Headings/Headings.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import styled from '@emotion/styled' | ||
import { Heading as OriginHeading } from '@asmy/core-design' | ||
|
||
const headingsWithFontStyle = { | ||
H1: props => <OriginHeading.H1 fontStyle="font_h1_slab" {...props} />, | ||
H2: props => <OriginHeading.H2 fontStyle="font_h2_slab" {...props} />, | ||
H3: props => <OriginHeading.H3 fontStyle="font_h3_slab" {...props} />, | ||
H4: props => <OriginHeading.H4 fontStyle="font_h3_slab" {...props} />, | ||
H5: props => <OriginHeading.H5 fontStyle="font_h3_slab" {...props} />, | ||
H6: props => <OriginHeading.H6 fontStyle="font_h3_slab" {...props} />, | ||
} | ||
|
||
const H1 = styled(headingsWithFontStyle.H1)`grid-column: 1 / span 12` | ||
const H2 = styled(headingsWithFontStyle.H2)`grid-column: 1 / span 12` | ||
const H3 = styled(headingsWithFontStyle.H3)`grid-column: 1 / span 12` | ||
const H4 = styled(headingsWithFontStyle.H4)`grid-column: 1 / span 12` | ||
const H5 = styled(headingsWithFontStyle.H5)`grid-column: 1 / span 12` | ||
const H6 = styled(headingsWithFontStyle.H6)`grid-column: 1 / span 12` | ||
|
||
export { H1, H2, H3, H4, H5, H6 } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { H1, H2, H3, H4, H5, H6 } from './Headings' |
12 changes: 12 additions & 0 deletions
12
examples/nextjs-integration/components/docs/Paragraph/Paragraph.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import styled from '@emotion/styled' | ||
import { Text as OriginText } from '@asmy/core-design' | ||
|
||
const Text = props => <OriginText fontStyle="font_p24_strong" {...props} /> | ||
|
||
const Paragraph = styled(Text)` | ||
margin-top: 20px; | ||
grid-column: 1 / span 12 | ||
` | ||
|
||
export { Paragraph } | ||
export default Paragraph |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { deafult, Paragraph } from './Paragraph' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import styled from '@emotion/styled' | ||
|
||
const OriginPre = styled.pre` | ||
margin: 0; | ||
padding: 40px; | ||
background-color: #f2f2f2; | ||
` | ||
|
||
const Pre = styled(OriginPre)` | ||
grid-column: 1 / span 12; | ||
` | ||
|
||
export { Pre } | ||
export default Pre |
File renamed without changes.
13 changes: 13 additions & 0 deletions
13
examples/nextjs-integration/components/docs/Table/Table.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import styled from '@emotion/styled' | ||
|
||
const OriginTable = styled.table` | ||
border: 1px solid black; | ||
border-collapse: collapse; | ||
` | ||
|
||
const Table = styled(OriginTable)` | ||
grid-column: 1 / span 12; | ||
` | ||
|
||
export { Table } | ||
export default Table |
File renamed without changes.
17 changes: 17 additions & 0 deletions
17
examples/nextjs-integration/components/docs/TableCells/TableCell.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import styled from '@emotion/styled' | ||
|
||
import { font_p24_strong } from '@asmy/core-design' | ||
|
||
const TD = styled.td` | ||
padding: 12px; | ||
border: 1px solid black; | ||
text-align: left; | ||
vertical-align: top; | ||
${font_p24_strong} | ||
` | ||
const TH = styled(TD.withComponent('th'))` | ||
vertical-align: middle; | ||
color: white !important; | ||
` | ||
|
||
export { TD, TH } |
1 change: 1 addition & 0 deletions
1
examples/nextjs-integration/components/docs/TableCells/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { TD, TH } from './TableCell' |
14 changes: 14 additions & 0 deletions
14
examples/nextjs-integration/components/docs/TableRow/TableRow.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import styled from '@emotion/styled' | ||
|
||
const TableRow = styled.tr` | ||
thead & { | ||
background-color: #343434; | ||
} | ||
:nth-of-type(even) { | ||
background-color: #f2f2f2; | ||
} | ||
` | ||
|
||
export { TableRow } | ||
export default TableRow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default, TableRow } from './TableRow' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import React from 'react' | ||
import App, { Container } from 'next/app' | ||
|
||
import { H1, H2, H3, H4, H5, H6 } from '../components/docs/Headings' | ||
import { Paragraph } from '../components/docs/Paragraph' | ||
import { Table } from '../components/docs/Table' | ||
import { TableRow } from '../components/docs/TableRow' | ||
import { Pre } from '../components/docs/Pre' | ||
import { TD, TH } from '../components/docs/TableCells' | ||
import { ProjectLayout } from '../components/ProjectLayout' | ||
|
||
import { Grid } from '@asmy/core-design' | ||
|
||
|
||
const components = { | ||
h1: H1, | ||
h2: H2, | ||
h3: H3, | ||
h4: H4, | ||
h5: H5, | ||
h6: H6, | ||
p: Paragraph, | ||
table: Table, | ||
tr: TableRow, | ||
td: TD, | ||
th: TH, | ||
pre: Pre, | ||
wrapper: Grid, | ||
} | ||
|
||
class MyApp extends App { | ||
static async getInitialProps({ Component, ctx }) { | ||
let pageProps = {}; | ||
|
||
if (Component.getInitialProps) { | ||
pageProps = await Component.getInitialProps(ctx); | ||
} | ||
|
||
if (ctx.pathname.slice(0, 5) === '/docs') { | ||
pageProps.isDocsPage = true | ||
} | ||
|
||
return { pageProps }; | ||
} | ||
|
||
render() { | ||
const { Component, pageProps } = this.props; | ||
|
||
return ( | ||
<Container> | ||
{pageProps.isDocsPage | ||
? <ProjectLayout> | ||
<Component | ||
components={components} | ||
{...pageProps} | ||
/> | ||
</ProjectLayout> | ||
|
||
: <Component {...pageProps} /> | ||
} | ||
</Container> | ||
); | ||
} | ||
} | ||
|
||
export default MyApp; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { css } from '@emotion/core' | ||
import { Button } from '@asmy/core-design' | ||
|
||
# Button | ||
|
||
<Button | ||
css={css`grid-column: 1 / span 3;`} | ||
kind="primary" | ||
onClick={() => alert('Ты кликнул кнопку')} | ||
> | ||
Кнопка | ||
</Button> | ||
|
||
<Button | ||
css={css`grid-column: 4 / span 3;`} | ||
kind="primary" | ||
onClick={() => alert('Ты кликнул кнопку')} | ||
disabled | ||
> | ||
Кнопка | ||
</Button> | ||
|
||
<Button | ||
css={css`grid-column: 7 / span 3;`} | ||
kind="secondary" | ||
onClick={() => alert('Ты кликнул кнопку')} | ||
> | ||
Кнопка | ||
</Button> | ||
|
||
<Button | ||
css={css`grid-column: 10 / span 3;`} | ||
kind="secondary" | ||
onClick={() => alert('Ты кликнул кнопку')} | ||
disabled | ||
> | ||
Кнопка | ||
</Button> | ||
|
||
Компонент кнопки. Используется как триггер для выполнения определённого действия. Кнопка однозначно сообщает пользователю, что произойдёт после нажатия на неё. | ||
|
||
--------------------------------------- | ||
## Свойства | ||
Имя | Допустимые значения | Значение по умолчанию | Комментарий | ||
--------- | -------------------- | --------------------- | ---------------- | ||
kind | primary \| secondary | primary | Тема кнопки | ||
disabled | true \| false | false | Отвечает за disabled состояние кнопки | ||
|
||
--------------------------------------- | ||
## Хендлеры | ||
Имя | Аргументы | Комментарий | ||
--------- | --------- | --------------- | ||
onClick | event | Функция, которая будет исполнятся при клике на кнопку | ||
|
||
--------------------------------------- | ||
## Код | ||
``` | ||
import { Button } from '@asmy/core-design' | ||
<Button | ||
kind="secondary" | ||
onClick={handleClick} | ||
disabled | ||
> | ||
Кнопка | ||
</Button> | ||
``` |
Oops, something went wrong.