Skip to content

Commit

Permalink
fix: create contract popover style
Browse files Browse the repository at this point in the history
  • Loading branch information
marslavish committed Sep 17, 2024
1 parent 336edd3 commit b2db706
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const ContentViews = {

type ContentView = (typeof ContentViews)[keyof typeof ContentViews];

const createContractOptions = [
const contractCreationOptions = [
{ label: 'From Upload', value: ContentViews.CREATE_FROM_UPLOAD },
{ label: 'From Code ID', value: ContentViews.CREATE_FROM_CODE_ID },
];
Expand All @@ -38,9 +38,10 @@ export const MyContractsTab = ({ show, switchTab }: MyContractsTabProps) => {
switchTab={switchTab}
createContractTrigger={
<PopoverSelect
trigger={<Button variant="primary">Create New Contract</Button>}
options={createContractOptions}
trigger={<Button variant="primary">Create Contract</Button>}
options={contractCreationOptions}
onOptionClick={(value) => setContentView(value as ContentView)}
popoverWidth="152px"
/>
}
/>
Expand Down
11 changes: 7 additions & 4 deletions examples/chain-template/components/contract/PopoverSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,14 @@ type PopoverSelectProps = {
trigger: React.ReactNode;
options: Option[];
onOptionClick: (value: string) => void;
popoverWidth?: string;
};

export const PopoverSelect = ({
trigger,
options,
onOptionClick,
popoverWidth = '100%',
}: PopoverSelectProps) => {
const [isPopoverOpen, setIsPopoverOpen] = useState(false);

Expand All @@ -45,8 +47,8 @@ export const PopoverSelect = ({
<Box
display="flex"
flexDirection="column"
// width={`${elemWidth}px`}
py="10px"
width={popoverWidth}
p="10px"
bg="$background"
borderRadius="4px"
boxShadow={`0px 4px 20px 0px rgba(${
Expand Down Expand Up @@ -85,10 +87,11 @@ const CustomOption = ({
gap="10px"
alignItems="center"
minHeight="40px"
px="20px"
px="10px"
cursor="pointer"
borderRadius="4px"
bg={{
hover: useColorModeValue('$blackAlpha100', '$whiteAlpha100'),
hover: useColorModeValue('$gray100', '$whiteAlpha100'),
base: '$background',
}}
attributes={{ onClick }}
Expand Down
2 changes: 2 additions & 0 deletions examples/chain-template/config/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const lightColors: ThemeDef['vars']['colors'] = {
blackAlpha200: '#D5DDE9',
blackAlpha100: '#F6F8FE',
blackAlpha50: '#FBFBFB',
gray100: '#EFF2F4',
white: '#FFFFFF',
background: '#FFFFFF',
green600: '#38A169',
Expand Down Expand Up @@ -53,6 +54,7 @@ export const darkColors: ThemeDef['vars']['colors'] = {
blackAlpha200: '#443F4B',
blackAlpha100: '#29262F',
blackAlpha50: '#1D2328',
gray100: '#EFF2F4',
white: '#FFFFFF',
background: '#232A31',
green600: '#38A169',
Expand Down

0 comments on commit b2db706

Please sign in to comment.