Skip to content

feat(demo): add styleguidist demo #13

Merged
merged 18 commits into from
Apr 26, 2017
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added arui-demo/README.md
Empty file.
7 changes: 7 additions & 0 deletions arui-demo/components/logo.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as React from 'react';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

А зачем такой сложный import?


export default () => (
<a href='https://github.com/alfa-laboratory/arui-feather' title='Fork me on GitHub'>
<img alt={ true } src='https://rawgit.com/alfa-laboratory/arui-feather/master/logo.svg' />
</a>
);
41 changes: 41 additions & 0 deletions arui-demo/components/preview-with-theme-switcher/index.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
.preview-with-theme-switcher {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

На каждый наш файлик нужно навешивать лицензию. Можно посмотреть на лицензии в файлах ./src/

&__layout {
margin-top: 20px;
margin-bottom: -5px;
border-radius: 5px;

&_theme_alfa-on-white {
color: #000;
border: solid 1px #eee;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я думаю раз это дублируется можно просто вынести из модификатора.

}

&_theme_alfa-on-color {
color: #fff;
background: #4d545b;
background: linear-gradient(to bottom, #4d545b 0%, #4d545b 50%, #282c36 100%);
border: solid 1px #eee;
}
}

&__wrapper {
margin: 15px;
}

&__button-group {
position: absolute;
top: 5px;
left: 8px;
}

&__button {
color: #1978c8;
background: white;
border: none;
font-size: 14px;

&:hover {
color: #f28a25;
cursor: pointer;
}
}
}
54 changes: 54 additions & 0 deletions arui-demo/components/preview-with-theme-switcher/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import React from 'react';
import Type from 'prop-types';
import { autobind } from 'core-decorators';
import ThemeProvider from '../../../src/theme-provider/theme-provider';
import cn from '../../../src/cn';
import './index.css';

const lightTheme = 'alfa-on-white';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

КОНСТАНТЫ_ВОТ_ТАК

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

КОНСТАНТЫ_ВОТ_ТАК - рудимент из времен, когда не было ключевого слова const.
Но ок

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это подсказка в месте чтения, что исползуется именно константа.

const darkTheme = 'alfa-on-color';

@cn('preview-with-theme-switcher')
class PreviewWithThemeSwitcher extends React.Component {
static propTypes = {
children: Type.oneOfType([Type.arrayOf(Type.node), Type.node])
};
state = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Стоит добавить отступы между блоками. Это облегчает чтение.

theme: lightTheme
}
render(cn) {
const themes = [lightTheme, darkTheme];
return (
<div>
<div className={ cn('button-group') } >
{themes.map(theme => (
<button
key={ theme }
className={ cn('button') }
onClick={ () => this.handleOnChange(theme) }
>
{ this.renderThemeText(theme) }
</button>
))}
</div>
<div className={ cn('layout', { theme: this.state.theme }) } >
<ThemeProvider theme={ this.state.theme } >
<div className={ cn('wrapper') }>
{this.props.children}
</div>
</ThemeProvider>
</div>
</div>
);
}

renderThemeText(theme) {
return theme === lightTheme ? 'светлая' : 'темная';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Мне, кажется, здесь есть небольшая проблема. Когда человек в первый раз открывает сраницу и видит "светлая" / "темная" он не понимает контекст, что это тема. Стоит либо добавить тайтл "Тема" или просто перефразировать "На светлом" / "На темном".

}

@autobind
handleOnChange(theme) {
this.setState({ theme });
}
}
export default PreviewWithThemeSwitcher;
7 changes: 7 additions & 0 deletions arui-demo/styleguide/build/1.f28d881c.js

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions arui-demo/styleguide/build/bundle.1b34f3d5.js

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
11 changes: 11 additions & 0 deletions arui-demo/styleguide/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<!doctype html>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Генерится стайлгайдистом

<html>
<head>
<meta charset="utf-8">
<title>ARUI FEATHER</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maximum-scale?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Генерится стайлгайдистом

</head>
<body>
<div id="app"></div>
<script type="text/javascript" src="build/bundle.1b34f3d5.js"></script></body>
</html>
28 changes: 0 additions & 28 deletions docs/checkbox-group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,34 +6,6 @@
import CheckboxGroup from 'arui-feather/checkbox-group';
```

## Примеры


```
import 'CheckBox' from 'arui-feather/src/checkbox/checkbox';
import 'CheckBoxGroup' from 'arui-feather/src/checkbox-group/checkbox-group';

// Вертикальная группа чекбоксов
<CheckBoxGroup>
<CheckBox text="Раз" />
<CheckBox text="Два" />
<CheckBox text="Три" />
</CheckBoxGroup>

// Горизонтальная группа чекбоксов, состоящая из обычных кнопок
<CheckBoxGroup type="button">
<CheckBox type="button" text="Раз" />
<CheckBox type="button" text="Два" />
<CheckBox type="button" text="Три" />
</CheckBoxGroup>

// Горизонтальная группа чекбоксов
<CheckBoxGroup type="line">
<CheckBox text="Раз" />
<CheckBox text="Два" />
<CheckBox text="Три" />
</CheckBoxGroup>
```



Expand Down
29 changes: 0 additions & 29 deletions docs/form-field/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,6 @@
import FormField from 'arui-feather/form-field';
```

## Примеры


```javascript
import FormField from 'arui-feather/form-field';
import Input from 'arui-feather/input';

<FormField label="Текстовое поле">
<Input />
</FormField>
```

Компонент может использоваться для отображения заголовков слева от блока.
Используется совместно с компонентом `AppContent`.

```javascript
import AppContent from 'arui-feather/src/app-content/app-content';
import FormField from 'arui-feather/src/form-field/form-field';
import Label from 'arui-feather/src/label/label';

<AppContent>
<FormField view="line" label={ <Label>Заголовок блока</Label> }>
Содержимое блока
</FormField>
<FormField view="line" label={ <Label>Заголовок блока</Label> }>
Содержимое блока
</FormField>
</AppContent>
```



Expand Down
6 changes: 0 additions & 6 deletions docs/highlight/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@
import Highlight from 'arui-feather/highlight';
```

## Примеры


```javascript
Слоган <Highlight>«Найдётся всё»</Highlight> придумали в 2000 году.
```



Expand Down
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
"demo": "node demo",
"test": "karma start ./karma.config.js",
"lint": "npm run lint-css && npm run lint-js",
"lint-js": "eslint ./*.js ./src/ ./demo/ ./gemini/ --ext .js,.jsx",
"lint-css": "stylelint ./src/**/*.css",
"lint-js": "eslint ./*.js ./src/ ./demo/ ./gemini/ ./arui-demo/components --ext .js,.jsx",
"lint-css": "stylelint ./src/**/*.css ./arui-demo/**/*.css",
"quality-check": "npm run lint && npm run test",
"quality-check-js": "npm run lint-js && npm run test",
"quality-check-ci": "ALL_SIZES=1 npm-run-all -l -p lint test gemini",
Expand All @@ -33,7 +33,9 @@
"precommit": "npm run docs && git add docs && node ./.githooks/pre-commit/test",
"docs": "gulp --cwd . --gulpfile ./node_modules/library-utils/gulpfile.js docs",
"compile": "gulp --cwd . --gulpfile ./node_modules/library-utils/gulpfile.js compile",
"pub": "npm run compile && cd .publish && npm publish"
"pub": "npm run compile && cd .publish && npm publish",
"styleguide": "styleguidist server",
"styleguide:build": "styleguidist build"
},
"maintainers": [
{
Expand Down Expand Up @@ -123,6 +125,7 @@
"react-hot-loader": "3.0.0-beta.1",
"redbox-react": "^1.3.5",
"rimraf": "^2.5.2",
"react-styleguidist": "^5.0.6",
"stylelint": "^7.10.1",
"uppercamelcase": "^1.1.0",
"validate-commit-message": "^3.0.1",
Expand Down
43 changes: 43 additions & 0 deletions src/amount/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
```
const AMOUNT = {
value: 123535,
currency: {
code: 'RUR',
minority: 100
}
};
<div>
{['s', 'm', 'l', 'xl'].map(size => (
<div key={ size }>
<Amount
size={ size }
amount={ AMOUNT }
/>
</div>
))}
</div>

```

Использовать компонент Heading для вывода числа
```
const AMOUNT = {
value: 123343,
currency: {
code: 'RUR',
minority: 10
}
};
<div>
{['s', 'm', 'l', 'xl'].map(size => (
<div key={ size }>
<Amount
size={ size }
amount={ AMOUNT }
isHeading={ true }
/>
</div>
))}
</div>

```
61 changes: 61 additions & 0 deletions src/attach/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
```
<div>
<div>
{['s', 'm', 'l', 'xl'].map(size => (
<div className='layout' key={ size }>
<Attach
size={size}
/>
</div>
))}
</div>
<div>
{['s', 'm', 'l', 'xl'].map(size => (
<div className='layout' key={ size }>
<Attach
size={size}
disabled={ true }
/>
</div>
))}
</div>
</div>
```
```
<div>
<div>
{['s', 'm', 'l', 'xl'].map(size => (
<div className='layout' key={ size }>
<Attach
size={size}
buttonContent='Please, choose a file'
noFileText='file in pdf format'
buttonProps={ {
pseudo: true,
icon: <Icon size={size} icon='search' />
} }
/>
</div>
))}
</div>
</div>
```


```

function handleChange(value) {
setState({value});
}

<div>
<div className='layout'>
<Attach
size='s'
buttonContent={ state.value ? 'Choose another file' : 'Choose a file' }
onChange={ handleChange }
value={ state.value }
/>
</div>
</div>
```
18 changes: 18 additions & 0 deletions src/button/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
```
<div>
<div>
{['s', 'm', 'l', 'xl'].map(size => (
<div key={ size }>
<Button size={ size }>{`Button ${size}`}</Button>
</div>
))}
</div>
<div>
{['s', 'm', 'l', 'xl'].map(size => (
<div key={ size }>
<Button size={ size } disabled={ true }>{`disabled Button ${size}`}</Button>
</div>
))}
</div>
</div>
```
Empty file added src/calendar-input/README.md
Empty file.
Loading