Skip to content

Commit

Permalink
adding dvh utilities for h-screen (#3163)
Browse files Browse the repository at this point in the history
This PR closes #2865

Added new utility classes in tailwind config for `dvh` units which takes
account for dynamically changing mobile browser view port.

Co-authored-by: Your Name <you@example.com>
  • Loading branch information
gsaivinay and Your Name committed May 19, 2023
1 parent a28a484 commit 0b577aa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion website/src/components/Layout/ChatLayout.tsx
Expand Up @@ -9,7 +9,7 @@ import { SideMenuItem } from "../SideMenu";
import { ToSWrapper } from "../ToSWrapper";

export const ChatLayout = ({ children }: PropsWithChildren) => (
<div className="min-h-screen h-screen max-h-screen flex flex-col overflow-hidden">
<div className="min-h-screen-dvh h-screen-dvh max-h-screen-dvh flex flex-col overflow-hidden">
<Header fixed={false} preLogoSlot={<ChatListMobile />}></Header>
<ToSWrapper>
<div className="flex min-h-0 h-full">
Expand Down
19 changes: 18 additions & 1 deletion website/tailwind.config.js
@@ -1,4 +1,5 @@
const defaultTheme = require("tailwindcss/defaultTheme");
const plugin = require("tailwindcss/plugin");

/** @type {import('tailwindcss').Config} */
module.exports = {
Expand Down Expand Up @@ -77,5 +78,21 @@ module.exports = {
},
},
},
plugins: [require("@tailwindcss/forms")],
plugins: [
require("@tailwindcss/forms"),
plugin(function ({ addUtilities, }) {
addUtilities({
// keeping '100vh' as a fallback for non supporting browsers
'.h-screen-dvh': {
height: ['100vh', '100dvh'],
},
'.min-h-screen-dvh': {
height: ['100vh', '100dvh'],
},
'.max-h-screen-dvh': {
height: ['100vh', '100dvh'],
},
})
}),
],
};

0 comments on commit 0b577aa

Please sign in to comment.