forked from binary-com/deriv-app
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[42069] Aizad: Creating Base Button for Wallets (binary-com#10649)
* chore: create base button component for wallets * chore: replace some of the components with WalletButton and added extra props * fix: added more components with WalletButton and WalletText * fix: resolve comments
- Loading branch information
1 parent
c443ed7
commit b79c9f8
Showing
23 changed files
with
180 additions
and
192 deletions.
There are no files selected for viewing
22 changes: 0 additions & 22 deletions
22
packages/wallets/src/components/Base/PrimaryActionButton/PrimaryActionButton.scss
This file was deleted.
Oops, something went wrong.
16 changes: 0 additions & 16 deletions
16
packages/wallets/src/components/Base/PrimaryActionButton/PrimaryActionButton.tsx
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/wallets/src/components/Base/PrimaryActionButton/index.ts
This file was deleted.
Oops, something went wrong.
11 changes: 0 additions & 11 deletions
11
packages/wallets/src/components/Base/SecondaryActionButton/SecondaryActionButton.scss
This file was deleted.
Oops, something went wrong.
10 changes: 0 additions & 10 deletions
10
packages/wallets/src/components/Base/SecondaryActionButton/SecondaryActionButton.tsx
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
packages/wallets/src/components/Base/SecondaryActionButton/index.ts
This file was deleted.
Oops, something went wrong.
75 changes: 75 additions & 0 deletions
75
packages/wallets/src/components/Base/WalletButton/WalletButton.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
.wallets-button { | ||
display: inline-flex; | ||
justify-content: center; | ||
align-items: center; | ||
gap: 0.8rem; | ||
cursor: pointer; | ||
&:disabled { | ||
opacity: 0.32; | ||
cursor: not-allowed; | ||
} | ||
&-size-sm { | ||
padding: 0.3rem 0.8rem; | ||
font-size: 1.2rem; | ||
line-height: 1.8rem; | ||
} | ||
&-size-md { | ||
height: 3.2rem; | ||
padding: 0.6rem 1.6rem; | ||
flex-shrink: 0; | ||
font-size: 1.4rem; | ||
} | ||
&-size-lg { | ||
height: 4rem; | ||
padding: 1rem 1.6rem; | ||
flex-shrink: 0; | ||
font-size: 1.4rem; | ||
} | ||
&-variant-contained { | ||
border: none; | ||
} | ||
&-variant-outlined { | ||
border: 1px solid var(--system-light-3-less-prominent-text, #999); | ||
background: none; | ||
&:hover { | ||
background: rgba(0, 0, 0, 0.08); | ||
} | ||
} | ||
&-variant-text { | ||
background: none; | ||
border: none; | ||
&:hover { | ||
background: rgba(255, 68, 79, 0.08); | ||
} | ||
} | ||
&-rounded-default { | ||
border-radius: 0.4rem; | ||
} | ||
&-rounded-full { | ||
border-radius: 6.4rem; | ||
} | ||
&-color-primary { | ||
background: var(--brand-coral, #ff444f); | ||
&:hover { | ||
background: var(--button-primary-hover-light, #eb3e48); | ||
} | ||
} | ||
&-color-primary-light { | ||
background: var(--button-primary-light-default, rgba(255, 68, 79, 0.16)); | ||
&:hover { | ||
background: var(--button-primary-light-hover, rgba(255, 68, 79, 0.24)); | ||
} | ||
} | ||
&-color-white { | ||
background: var(--system-light-8-primary-background, #fff); | ||
&:hover { | ||
background: var(--system-light-5-active-background, #d6dadb); | ||
} | ||
} | ||
&-color-black { | ||
background: var(--system-dark-8-primary-background, #0e0e0e); | ||
&:hover { | ||
background: var(--system-dark-5-active-background, #323738); | ||
} | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
packages/wallets/src/components/Base/WalletButton/WalletButton.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React, { ComponentProps, CSSProperties } from 'react'; | ||
import classNames from 'classnames'; | ||
import styles from './WalletButton.module.css'; | ||
|
||
interface WalletButtonProps extends ComponentProps<'button'> { | ||
children: React.ReactNode; | ||
color?: CSSProperties['color'] | 'primary-light' | 'primary'; | ||
isRounded?: boolean; | ||
size?: 'lg' | 'md' | 'sm'; | ||
variant?: 'contained' | 'outlined' | 'text'; | ||
} | ||
|
||
const WalletButton: React.FC<WalletButtonProps> = ({ | ||
children, | ||
color = 'primary', | ||
isRounded = false, | ||
size = 'md', | ||
variant = 'contained', | ||
...rest | ||
}) => { | ||
const isContained = variant === 'contained'; | ||
const buttonClassNames = classNames( | ||
styles[`wallets-button`], | ||
(isContained && styles[`wallets-button-color-${color}`]) || '', | ||
styles[`wallets-button-size-${size}`], | ||
styles[`wallets-button-variant-${variant}`], | ||
isRounded ? styles[`wallets-button-rounded-full`] : styles[`wallets-button-rounded-default`] | ||
); | ||
|
||
return ( | ||
<button className={buttonClassNames} {...rest}> | ||
{children} | ||
</button> | ||
); | ||
}; | ||
|
||
export default WalletButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default as WalletButton } from './WalletButton'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,8 @@ | ||
export * from './InlineMessage'; | ||
export * from './ModalStepWrapper'; | ||
export * from './ModalWrapper'; | ||
export * from './PrimaryActionButton'; | ||
export * from './ProgressBar'; | ||
export * from './SecondaryActionButton'; | ||
export * from './Tabs'; | ||
export * from './WalletButton'; | ||
export * from './WalletClipboard'; | ||
export * from './WalletText'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 0 additions & 34 deletions
34
packages/wallets/src/features/cfd/flows/MT5/AddedMT5AccountsList/AddedMT5AccountsList.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.