-
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.
- Loading branch information
Showing
11 changed files
with
280 additions
and
132 deletions.
There are no files selected for viewing
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
48 changes: 48 additions & 0 deletions
48
src/screens/staking/components/staking_section/select_base.module.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
.control { | ||
border-radius: 8px; | ||
box-shadow: | ||
0 14px 64px -4px #0226e11f, | ||
0 8px 22px -6px #0226e11f; | ||
height: 80px; | ||
margin: 0; | ||
overflow: hidden; | ||
width: 100%; | ||
} | ||
|
||
.select { | ||
height: 100%; | ||
width: 100%; | ||
|
||
:global(.MuiOutlinedInput-notchedOutline) { | ||
background-color: transparent !important; | ||
border: none; | ||
outline-color: transparent !important; | ||
|
||
&:hover { | ||
background-color: transparent !important; | ||
border: none !important; | ||
border-color: transparent !important; | ||
border-right-style: none !important; | ||
box-shadow: none !important; | ||
outline: none !important; | ||
} | ||
} | ||
|
||
:global(.MuiSelect-select.MuiSelect-outlined.MuiInputBase-input) { | ||
align-items: center; | ||
align-self: stretch; | ||
display: flex; | ||
height: 100%; | ||
justify-content: center; | ||
padding: 0 !important; | ||
} | ||
} | ||
|
||
.trigger { | ||
cursor: pointer; | ||
margin-right: 20px; | ||
|
||
&.disabled { | ||
cursor: not-allowed; | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
src/screens/staking/components/staking_section/select_base.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,30 @@ | ||
import IconChevronDown from "@src/components/icons/icon_chevron_down.svg"; | ||
|
||
import * as styles from "./select_base.module.scss"; | ||
|
||
const ITEM_HEIGHT = 48; | ||
const ITEM_PADDING_TOP = 8; | ||
|
||
export const IconComponent = ({ className }: { className: string }) => ( | ||
<IconChevronDown | ||
className={[ | ||
className, | ||
styles.trigger, | ||
className.includes("disabled") ? styles.disabled : "", | ||
].join(" ")} | ||
/> | ||
); | ||
|
||
export const MenuProps = { | ||
PaperProps: { | ||
style: { | ||
maxHeight: ITEM_HEIGHT * 4.5 + ITEM_PADDING_TOP, | ||
width: 250, | ||
}, | ||
}, | ||
}; | ||
|
||
export const selectStyles = { | ||
control: styles.control, | ||
select: styles.select, | ||
}; |
34 changes: 34 additions & 0 deletions
34
src/screens/staking/components/staking_section/stake_accounts_select.module.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
.row { | ||
align-items: center; | ||
display: flex; | ||
flex: 1; | ||
flex-direction: row; | ||
font-size: 18px; | ||
font-weight: 600; | ||
gap: 20px; | ||
justify-content: flex-start; | ||
letter-spacing: 0.006em; | ||
line-height: 21px; | ||
min-height: 70px; | ||
padding: 0 80px 0 16px; | ||
width: 100%; | ||
} | ||
|
||
:global(.MuiMenuItem-root) .row { | ||
&:hover { | ||
background: linear-gradient( | ||
286.17deg, | ||
rgba(212, 49, 238, 0.24) 0%, | ||
rgba(255, 66, 107, 0.24) 100% | ||
); | ||
} | ||
} | ||
|
||
.icon { | ||
height: 24px; | ||
width: 24px; | ||
} | ||
|
||
.address { | ||
flex: 1; | ||
} |
60 changes: 60 additions & 0 deletions
60
src/screens/staking/components/staking_section/stake_accounts_select.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,60 @@ | ||
import MenuItem from "@mui/material/MenuItem"; | ||
import Select from "@mui/material/Select"; | ||
|
||
import { formatCoin } from "@src/screens/staking/lib/staking_sdk/formatters"; | ||
import type { StakeAccount } from "@src/screens/staking/lib/staking_sdk/staking_client_types"; | ||
|
||
import { IconComponent, MenuProps, selectStyles } from "./select_base"; | ||
import * as styles from "./stake_accounts_select.module.scss"; | ||
|
||
type Props = { | ||
accounts: StakeAccount[]; | ||
disabled?: boolean; | ||
onChange: (account: string) => void; | ||
selectedAccount: null | string; | ||
}; | ||
|
||
const StakeAccountsSelect = ({ | ||
accounts, | ||
disabled, | ||
onChange, | ||
selectedAccount, | ||
}: Props) => ( | ||
<div className={selectStyles.control}> | ||
<Select | ||
IconComponent={IconComponent} | ||
MenuProps={MenuProps} | ||
className={selectStyles.select} | ||
disabled={disabled} | ||
onChange={(e) => onChange(e.target.value as string)} | ||
value={selectedAccount || accounts[0]?.address} | ||
> | ||
{accounts.map((account) => ( | ||
<MenuItem | ||
key={account.address} | ||
sx={{ padding: 0 }} | ||
value={account.address} | ||
> | ||
<div className={styles.row}> | ||
<img | ||
alt="" | ||
className={styles.icon} | ||
src="/icons/stake_account.svg" | ||
/> | ||
<div | ||
className={styles.address} | ||
>{`${account.address.slice(0, 11)}...`}</div> | ||
<div> | ||
{formatCoin({ | ||
amount: account.amount, | ||
denom: account.denom, | ||
})} | ||
</div> | ||
</div> | ||
</MenuItem> | ||
))} | ||
</Select> | ||
</div> | ||
); | ||
|
||
export default StakeAccountsSelect; |
Oops, something went wrong.