Skip to content

Commit

Permalink
Rename responsive helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
paulcretu committed Aug 31, 2023
1 parent 6cef670 commit 9d8c3b9
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 13 deletions.
4 changes: 2 additions & 2 deletions ui/src/components/BottomNav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
} from "@mui/material";
import { styled } from "@mui/material/styles";

import { displayMobile } from "@/styles/responsive";
import { displayMobileOnly } from "@/styles/responsive";

export default function BottomNav() {
return (
<Box sx={displayMobile}>
<Box sx={displayMobileOnly}>
<Paper
sx={{
position: "fixed",
Expand Down
8 changes: 4 additions & 4 deletions ui/src/components/Drawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ReactNode, useState } from "react";

import { PlayerSpacer } from "@/components/Player";
import useIsMobile from "@/hooks/useIsMobile";
import { displayDesktop, displayMobile } from "@/styles/responsive";
import { displayDesktopOnly, displayMobileOnly } from "@/styles/responsive";

export default function Drawer({
children,
Expand Down Expand Up @@ -63,13 +63,13 @@ function Mobile({ children, open, onOpen, onClose }: DrawerProps) {
swipeAreaWidth={100}
disableSwipeToOpen={false}
SwipeAreaProps={{
sx: displayMobile,
sx: displayMobileOnly,
}}
ModalProps={{
keepMounted: true,
}}
sx={{
...displayMobile,
...displayMobileOnly,
"& > .MuiPaper-root": {
height: 1,
},
Expand All @@ -94,7 +94,7 @@ function Desktop({ children, open, onOpen, onClose }: DrawerProps) {
if (!open) onOpen();
}}
sx={(theme) => ({
...displayDesktop,
...displayDesktopOnly,
width: theme.breakpoints.values.sm,
maxWidth: 0.5,
flexShrink: 0,
Expand Down
6 changes: 3 additions & 3 deletions ui/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { AppBar, Box, IconButton, Toolbar, Typography } from "@mui/material";
import { useState } from "react";

import Link from "@/components/Link";
import { displayDesktop, displayMobile } from "@/styles/responsive";
import { displayDesktopOnly, displayMobileOnly } from "@/styles/responsive";

export default function Header() {
return (
Expand All @@ -30,7 +30,7 @@ function Mobile() {
};

return (
<Box sx={displayMobile}>
<Box sx={displayMobileOnly}>
<Box
sx={{
flexGrow: 1,
Expand All @@ -55,7 +55,7 @@ function Mobile() {

function Desktop() {
return (
<Box sx={displayDesktop}>
<Box sx={displayDesktopOnly}>
<Brand />
</Box>
);
Expand Down
4 changes: 2 additions & 2 deletions ui/src/components/MapLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Drawer from "@/components/Drawer";
import Header from "@/components/Header";
import Player, { PlayerSpacer } from "@/components/Player";
import { useFeedQuery, useFeedsQuery } from "@/graphql/generated";
import { displayMobile } from "@/styles/responsive";
import { displayMobileOnly } from "@/styles/responsive";

const MapWithNoSSR = dynamic(() => import("./Map"), {
ssr: false,
Expand Down Expand Up @@ -92,7 +92,7 @@ function MapLayout({ children }: { children: ReactNode }) {
feeds={feeds}
/>
</Box>
<PlayerSpacer sx={displayMobile} />
<PlayerSpacer sx={displayMobileOnly} />
<Player currentFeed={currentFeed} />
</Box>
</Box>
Expand Down
4 changes: 2 additions & 2 deletions ui/src/styles/responsive.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Theme } from "@mui/material";

export const displayMobile = { display: { xs: "block", sm: "none" } };
export const displayDesktop = { display: { xs: "none", sm: "block" } };
export const displayMobileOnly = { display: { xs: "block", sm: "none" } };
export const displayDesktopOnly = { display: { xs: "none", sm: "block" } };

export const mobileOnly = (theme: Theme) => theme.breakpoints.down("sm");
export const desktopOnly = (theme: Theme) => theme.breakpoints.up("sm");

0 comments on commit 9d8c3b9

Please sign in to comment.