Skip to content

Commit

Permalink
feat(Skeleton): inline styles (#116)
Browse files Browse the repository at this point in the history
* feat: inline styles for skeleton + showcase

* docs: readme development

* fix: skeleton nice wave z-index

Co-authored-by: Leon Minasyan <[email protected]>
  • Loading branch information
ierehon1905 and ierehon1905 authored Mar 25, 2022
1 parent 095f425 commit bfbde83
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 7 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,11 @@ import {Button} from '@yandex-cloud/uikit';

const SubmitButton = <Button view="action" size="l" />;
```

## Development

To start the dev storybook

```shell
npm run start
```
1 change: 1 addition & 0 deletions src/components/Skeleton/Skeleton.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ $block: '.#{$ns}skeleton';
#{$block} {
display: inline-block;
position: relative;
z-index: 0;
width: 100%;
border-radius: 5px;
overflow: hidden;
Expand Down
11 changes: 5 additions & 6 deletions src/components/Skeleton/Skeleton.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import React from 'react';
import React, {HTMLAttributes} from 'react';
import {block} from '../utils/cn';

import './Skeleton.scss';

const b = block('skeleton');

export interface SkeletonProps {
className?: string;
}
export interface SkeletonProps
extends Pick<HTMLAttributes<HTMLDivElement>, 'className' | 'style'> {}

export function Skeleton({className}: SkeletonProps) {
return <div className={b(null, className)} />;
export function Skeleton({className, style}: SkeletonProps) {
return <div className={b(null, className)} style={style} />;
}
14 changes: 13 additions & 1 deletion src/components/Skeleton/__stories__/SkeletonShowcase.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const persons = [
{name: 'Al Coholic', info: 'Somewhere', info2: 'DevOps'},
];

export function SkeletonShowcase() {
function SkeletonListShowcase() {
const [listVisible, setListVisible] = React.useState(false);
return (
<div className={b()}>
Expand All @@ -60,3 +60,15 @@ export function SkeletonShowcase() {
</div>
);
}

export function SkeletonShowcase() {
return (
<>
<h1>Skeleton</h1>
<h2>List</h2>
<SkeletonListShowcase />
<h2>Styled with inline prop</h2>
<Skeleton style={{height: 100, width: 200}} />
</>
);
}

0 comments on commit bfbde83

Please sign in to comment.