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

#77 Header UI becomes distorted in tablet view #95

Merged
merged 3 commits into from
Jan 17, 2024
Merged
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
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
Loading