Skip to content

Commit

Permalink
#77 Header UI becomes distorted in tablet view (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
dandheedge authored Jan 17, 2024
1 parent dd40d90 commit e58915f
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions apps/web/src/components/layout/shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,16 @@ const Shell: FC<{ children: ReactNode }> = ({ children }) => {
},
] = useDisclosure(false);
const theme = useMantineTheme();
const isSmallDevice = useMediaQuery(`(max-width:${theme.breakpoints.sm})`);
const showWalletNavbar = useMediaQuery(
`(min-width:${theme.breakpoints.sm})`,
);
const showWalletSidebar = useMediaQuery(`(max-width:${767}px)`);
const hideBalanceViewport = useMediaQuery(
`(min-width:${theme.breakpoints.sm}) and (max-width:${50}em)`,
);
const { isConnected } = useAccount();
const { colorScheme, toggleColorScheme } = useMantineColorScheme();
const themeDefaultProps = theme.components?.AppShell?.defaultProps ?? {};

return (
<AppShell
header={themeDefaultProps.header}
Expand Down Expand Up @@ -85,7 +90,7 @@ const Shell: FC<{ children: ReactNode }> = ({ children }) => {
<Link href="/">
<CartesiLogo height={40} />
</Link>
<Group ml="xl" gap="md">
<Group ml={{ lg: "xl" }} gap="md">
<Button
variant="subtle"
leftSection={<TbArrowsDownUp />}
Expand All @@ -96,7 +101,11 @@ const Shell: FC<{ children: ReactNode }> = ({ children }) => {
>
Send Transaction
</Button>
{!isSmallDevice && <ConnectButton />}
{showWalletNavbar && (
<ConnectButton
showBalance={!hideBalanceViewport}
/>
)}
<Switch
checked={colorScheme === "dark"}
onChange={() => toggleColorScheme()}
Expand All @@ -118,7 +127,7 @@ const Shell: FC<{ children: ReactNode }> = ({ children }) => {
</Button>
</Group>
</AppShell.Header>
<AppShell.Aside p="md">
<AppShell.Aside p="md" zIndex={102}>
<ConnectionView />
</AppShell.Aside>
<AppShell.Navbar py="md" px={4} data-testid="navbar">
Expand Down Expand Up @@ -156,7 +165,7 @@ const Shell: FC<{ children: ReactNode }> = ({ children }) => {
hiddenFrom="sm"
/>

{isSmallDevice && <ConnectButton showBalance />}
{showWalletSidebar && <ConnectButton showBalance />}
</Stack>
</AppShell.Navbar>
<AppShell.Main>{children}</AppShell.Main>
Expand Down

2 comments on commit e58915f

@vercel
Copy link

@vercel vercel bot commented on e58915f Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on e58915f Jan 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

rollups-explorer-workshop – ./apps/workshop

rollups-explorer-workshop.vercel.app
rollups-explorer-workshop-cartesi.vercel.app
rollups-explorer-workshop-git-main-cartesi.vercel.app

Please sign in to comment.