Skip to content

Commit

Permalink
feat: relocate Button atom from WEB
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzhastin-Nikita authored and the-homeless-god committed May 26, 2022
1 parent 2775a7f commit 2da788b
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/components/atoms/Button/Button.styles.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
@import '@digitable-team/web-ui-components/src/scss/mixins';

.primary {
border: 1px solid $color-white;
border-radius: 6px;
padding: 18px 40px;
background: transparent;
color: $color-base;
}

.success {
border: 1px solid $color-base;
border-radius: 50px;
background: transparent;
color: $color-base;

&:hover {
opacity: 0.9;
}
}

.round {
border-radius: 36px;
}

.disabled {
color: $color-secondary;
border-color: $color-secondary;
}
44 changes: 44 additions & 0 deletions src/components/atoms/Button/Button.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import React, { ReactNode } from 'react'

import cx from 'classnames'

// eslint-disable-next-line css-modules/no-unused-class
import css from './Button.styles.module.scss'

export type ButtonProps = {
isRounded?: boolean
isDisabled?: boolean
className?: string
type: 'primary' | 'success'
buttonType?: 'button' | 'submit' | 'reset'
children?: ReactNode | string
name?: string
onClick?: () => void
}

export const Button = ({
isRounded,
buttonType,
type,
name,
children,
isDisabled,
className,
onClick
}: ButtonProps) => {
return (
<button
disabled={isDisabled}
type={buttonType}
role={name}
name={name}
onClick={onClick}
className={cx(className, css[type], {
[css.round]: isRounded,
[css.disabled]: isDisabled
})}
>
{children}
</button>
)
}
1 change: 1 addition & 0 deletions src/components/atoms/Button/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './Button'

0 comments on commit 2da788b

Please sign in to comment.