Skip to content

Commit

Permalink
feat(custom-button): update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fulcanellee committed Nov 20, 2024
1 parent ff93991 commit 3507c12
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 3 deletions.
5 changes: 5 additions & 0 deletions packages/custom-button/src/Component.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ describe('CustomButton', () => {
expect(container.firstElementChild).toHaveClass('disableType_static-inverted');
});
});

it('should have custom className', () => {
const { container } = render(<CustomButton className='customClass' />);
expect(container.firstElementChild).toHaveClass('customClass');
});
});

it('should unmount without errors', () => {
Expand Down
3 changes: 0 additions & 3 deletions packages/custom-button/src/Component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,6 @@ export const CustomButton = React.forwardRef<
styles[contentColor],
styles[stateType],
styles[`disableType_${disableType}`],
{
// [styles.customLoading]: loading,
},
);

return (
Expand Down
32 changes: 32 additions & 0 deletions packages/custom-button/src/docs/description.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -246,3 +246,35 @@ render(() => {
);
});
```

## Кастомный цвет контента

Для установки цвета контента можно использовать пропс `contentColor` который принимает четыре значения. Но также цвет можно переопределить через класс с помощью пропса `className`

```jsx live
render(() => {
return (
<React.Fragment>
<style>{'.customClass[type=button] * { color: #EB58BF }'}</style>

<Space size={16} direction='horizontal'>
<CustomButton
hint='Hint'
block={isMobile()}
backgroundColor={'var(--color-light-base-bg-secondary-inverted)'}
>
Label
</CustomButton>
<CustomButton
hint='Hint'
block={isMobile()}
backgroundColor={'var(--color-light-base-bg-secondary-inverted)'}
className={'customClass'}
>
Label
</CustomButton>
</Space>
</React.Fragment>
);
});
```

0 comments on commit 3507c12

Please sign in to comment.