diff --git a/pages/index.tsx b/pages/index.tsx index 4b981486d..0005eacd0 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -10,8 +10,8 @@ export default function Home() { {ButonType.light} - Button light {ButonType.light} - Button light {ButonType.light} - Button light - {ButtonSize.large} - Button default large - } disabled>Button with icon disabled + }>{ButtonSize.large} - Button default large + } disabled isIconSuffix={true}>Button with icon disabled } type={ButonType.light}>Button with icon

Go to pages/index.tsx to get your hand dirty!

Go to src/components to make your awesome component!

diff --git a/src/components/common/ButtonCommon/ButtonCommon.module.scss b/src/components/common/ButtonCommon/ButtonCommon.module.scss index eaf930670..81866b687 100644 --- a/src/components/common/ButtonCommon/ButtonCommon.module.scss +++ b/src/components/common/ButtonCommon/ButtonCommon.module.scss @@ -58,8 +58,15 @@ } } + &.preserve { + flex-direction: row-reverse; + .icon { + margin: 0 0 0 1.6rem; + } + } + .icon { - margin-right: 0.8rem; + margin: 0 1.6rem 0 0; svg path { fill: currentColor; } diff --git a/src/components/common/ButtonCommon/ButtonCommon.tsx b/src/components/common/ButtonCommon/ButtonCommon.tsx index 27a4f3d72..6993347e6 100644 --- a/src/components/common/ButtonCommon/ButtonCommon.tsx +++ b/src/components/common/ButtonCommon/ButtonCommon.tsx @@ -1,5 +1,5 @@ import classNames from 'classnames' -import React from 'react' +import React, { memo } from 'react' import { ButonType, ButtonSize } from 'src/utils/constanst.utils' import s from './ButtonCommon.module.scss' @@ -8,19 +8,21 @@ interface Props { type?: ButonType, size?: ButtonSize, icon?: any, + isIconSuffix?: boolean, loading?: boolean, disabled?: boolean, onClick?: () => void, } -const ButtonCommon = ({ type = ButonType.primary, size = ButtonSize.default, - icon, loading, disabled, children, onClick }: Props) => { +const ButtonCommon = memo(({ type = ButonType.primary, size = ButtonSize.default, + icon, loading, disabled, isIconSuffix, children, onClick }: Props) => { return ( ) -} +}) export default ButtonCommon