Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix account selector #116

Merged
merged 1 commit into from
May 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/AccountSelector/AccountSelector.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export default {
};

const args = {
avatar: <FiUser className="text-neutral h-6 w-6" />,
avatar: <FiUser className="text-primary h-6 w-6" />,
accountName: "account #",
icon: <MassaToken size={24} />,
icon: <MassaToken size={24} className="bg-neutral rounded-full" />,
amount: "0,000.00",
};

Expand Down
29 changes: 9 additions & 20 deletions src/components/AccountSelector/AccountSelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,48 +5,37 @@ import React from "react";
import { ReactNode, ComponentPropsWithoutRef } from "react";

export interface AccountSelectorProps extends ComponentPropsWithoutRef<"div"> {
avatar: ReactNode;
avatar: JSX.Element;
accountName: string;
icon: ReactNode;
icon: JSX.Element;
amount: string;
children?: ReactNode;
}

export function AccountSelector(props: AccountSelectorProps) {
let { avatar, accountName, icon, amount, children, ...rest } = props;

const accountSelectorClass = "flex flex-row items-center justify-between";

const hoverClass = `hover:bg-info`;
const activeClass = `active:bg-c-pressed`;

const containerFlexClass = "flex justify-center items-center";

return (
<div
className={`bg-neutral text-primary h-14 w-full p-3 rounded-lg mas-menu-active cursor-pointer
${accountSelectorClass}
${hoverClass}
${activeClass}`}
{...rest}
data-testid="account-selector-button"
className={`bg-primary text-f-primary h-14 w-full p-3 rounded-lg mas-menu-active cursor-pointer
flex flex-row items-center justify-between
hover:bg-tertiary
active:bg-secondary`}
{...rest}
>
<div className={`${containerFlexClass}`}>
<div
className={`bg-primary h-8 w-8 rounded-full mr-2 ${containerFlexClass}`}
className={`bg-neutral h-8 w-8 rounded-full mr-2 ${containerFlexClass}`}
>
{avatar}
</div>
<div>{accountName}</div>
</div>

<div className={`${containerFlexClass}`}>
<div
className={`mr-2 bg-primary h-6 w-6 rounded-full
${containerFlexClass}`}
>
{icon}
</div>
<div className={`mr-2 rounded-full ${containerFlexClass}`}>{icon}</div>
<div>{amount}</div>
</div>
</div>
Expand Down