-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: updated shards ui for shards select modal (#1138)
* feat: updated shards ui for shards select modal * feat: added accordion for chain * feat: updated address truncate for selectable shard --------- Co-authored-by: Egor B <[email protected]>
- Loading branch information
Showing
3 changed files
with
104 additions
and
45 deletions.
There are no files selected for viewing
53 changes: 53 additions & 0 deletions
53
src/renderer/entities/wallet/ui/SelectableShard/SelectableShard.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,53 @@ | ||
import { cnTw } from '@renderer/shared/lib/utils'; | ||
import { BodyText, Checkbox, HelpText, Icon, Identicon, InfoPopover, Truncate } from '@renderer/shared/ui'; | ||
import { Address, Explorer } from '@renderer/shared/core'; | ||
import { useAddressInfo } from '../../lib/useAddressInfo'; | ||
|
||
type Props = { | ||
name: string; | ||
className?: string; | ||
address: Address; | ||
checked: boolean; | ||
truncate?: boolean; | ||
semiChecked?: boolean; | ||
explorers?: Explorer[]; | ||
onChange: (value: boolean) => void; | ||
}; | ||
|
||
export const SelectableShard = ({ | ||
className, | ||
name, | ||
address, | ||
semiChecked, | ||
checked, | ||
truncate, | ||
explorers, | ||
onChange, | ||
}: Props) => { | ||
const popoverItems = useAddressInfo(address, explorers, false); | ||
|
||
return ( | ||
<Checkbox | ||
checked={checked} | ||
className={cnTw( | ||
'flex items-center gap-x-2 px-2 py-1.5 hover:bg-action-background-hover group rounded', | ||
className, | ||
)} | ||
semiChecked={semiChecked} | ||
onChange={(event) => onChange(event.target?.checked)} | ||
> | ||
<Identicon address={address} size={20} background={false} canCopy={false} /> | ||
<div className="truncate mr-auto"> | ||
<BodyText>{name}</BodyText> | ||
{truncate ? ( | ||
<Truncate text={address} className="text-text-tertiary text-help-text" /> | ||
) : ( | ||
<HelpText className="text-text-tertiary">{address}</HelpText> | ||
)} | ||
</div> | ||
<InfoPopover data={popoverItems} className="w-[230px]" position="right-0 top-full"> | ||
<Icon name="info" size={16} className="shrink-0 group-hover:text-icon-hover" /> | ||
</InfoPopover> | ||
</Checkbox> | ||
); | ||
}; |
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