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

Fixed placeholder spacing #1731

Merged
merged 9 commits into from
Nov 16, 2021
6 changes: 6 additions & 0 deletions packages/common-theme/src/Provider/ThemeSwitcherContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { useLocalStorage } from "@chainsafe/browser-storage-hooks"

type ThemeSwitcherContext = {
desktop: boolean
tablet: boolean
mobile: boolean
themeKey: string
availableThemes: string[]
setTheme(themeName: string): void
Expand All @@ -26,6 +28,8 @@ type ThemeSwitcherProps = {
const ThemeSwitcher = ({ children, themes, storageKey = "cs.themeKey" }: ThemeSwitcherProps) => {
const breakpoints = createBreakpoints({})
const desktop = useMediaQuery(breakpoints.up("md"))
const tablet = useMediaQuery(breakpoints.up("sm"))
Copy link
Contributor

Choose a reason for hiding this comment

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

question: with this implementation show the tablet variable as true in desktop screens ?
will this be better:
const tablet = useMediaQuery(breakpoints.up("sm")) && useMediaQuery(breakpoints.down("md"))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah so because desktop is an upward query, technically then we'd need to check if its between xl as well, though I'm not sure how many things we'd need to change to maintain that consistency

Copy link
Contributor

Choose a reason for hiding this comment

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

This is basically the equivalent of the between operator in MUI

Copy link
Contributor

Choose a reason for hiding this comment

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

yes, I would say keep the desktop as is, above md,
keep the tablet and mobile between screen sizes !

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So personally, I would also prefer only the two concepts to query against, but since this is in the theme kit, I would want it to be a bit more consistent with what one would expect from the kit, so just the Desktop & Tablet, I'd have it provided within the consuming codebase

const mobile = useMediaQuery(breakpoints.up("xs"))
const { canUseLocalStorage, localStorageGet, localStorageSet } = useLocalStorage()

// TODO: check min 1 theme
Expand Down Expand Up @@ -60,6 +64,8 @@ const ThemeSwitcher = ({ children, themes, storageKey = "cs.themeKey" }: ThemeSw
<ThemeSwitcherContext.Provider
value={{
desktop: desktop,
tablet: tablet,
mobile: mobile,
themeKey: current,
availableThemes: Object.keys(themes),
setTheme: setCurrent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ interface ICreateOrEditSharedFolderModalProps {

const CreateOrEditSharedFolderModal = ({ mode, isModalOpen, onClose, bucketToEdit }: ICreateOrEditSharedFolderModalProps) => {
const classes = useStyles()
const { desktop } = useThemeSwitcher()
const { desktop, tablet, mobile } = useThemeSwitcher()
const { handleCreateSharedFolder, handleEditSharedFolder, isEditingSharedFolder, isCreatingSharedFolder } = useCreateOrEditSharedFolder()
const [sharedFolderName, setSharedFolderName] = useState("")
const { sharedFolderReaders, sharedFolderWriters, onNewUsers, handleLookupUser, usersError, resetUsers } = useLookupSharedFolderUser()
Expand Down Expand Up @@ -260,6 +260,12 @@ const CreateOrEditSharedFolderModal = ({ mode, isModalOpen, onClose, bucketToEdi
...provided,
minHeight: 90,
alignContent: "start"
}),
valueContainer: (provided) => mobile && !tablet ? ({
...provided,
paddingBottom: 24
}) : ({
...provided
})
}}
loadingMessage={t`Loading`}
Expand All @@ -286,6 +292,12 @@ const CreateOrEditSharedFolderModal = ({ mode, isModalOpen, onClose, bucketToEdi
...provided,
minHeight: 90,
alignContent: "start"
}),
valueContainer: (provided) => mobile && !tablet ? ({
...provided,
paddingBottom: 24
}) : ({
...provided
})
}}
loadingMessage={t`Loading`}
Expand Down