mirror of
https://github.com/fosrl/pangolin.git
synced 2026-02-08 05:56:38 +00:00
🧑💻add tailwind indicator component
This commit is contained in:
@@ -21,6 +21,7 @@ import { build } from "@server/build";
|
||||
import { TopLoader } from "@app/components/Toploader";
|
||||
import Script from "next/script";
|
||||
import { ReactQueryProvider } from "@app/components/react-query-provider";
|
||||
import { TailwindIndicator } from "@app/components/TailwindIndicator";
|
||||
|
||||
export const metadata: Metadata = {
|
||||
title: `Dashboard - ${process.env.BRANDING_APP_NAME || "Pangolin"}`,
|
||||
@@ -129,6 +130,10 @@ export default async function RootLayout({
|
||||
</ThemeProvider>
|
||||
</NextIntlClientProvider>
|
||||
</ReactQueryProvider>
|
||||
|
||||
{process.env.NODE_ENV === "development" && (
|
||||
<TailwindIndicator />
|
||||
)}
|
||||
</body>
|
||||
</html>
|
||||
);
|
||||
|
||||
27
src/components/TailwindIndicator.tsx
Normal file
27
src/components/TailwindIndicator.tsx
Normal file
@@ -0,0 +1,27 @@
|
||||
"use client";
|
||||
import * as React from "react";
|
||||
|
||||
export function TailwindIndicator() {
|
||||
const [mediaSize, setMediaSize] = React.useState(0);
|
||||
React.useEffect(() => {
|
||||
const listener = () => setMediaSize(window.innerWidth);
|
||||
window.addEventListener("resize", listener);
|
||||
|
||||
listener();
|
||||
return () => {
|
||||
window.removeEventListener("resize", listener);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="fixed bottom-12 left-2 z-9999999 flex h-6 items-center justify-center gap-2 rounded-full bg-primary p-3 font-mono text-xs text-white">
|
||||
<div className="block sm:hidden">xs</div>
|
||||
<div className="hidden sm:block md:hidden">sm</div>
|
||||
<div className="hidden md:block lg:hidden">md</div>
|
||||
<div className="hidden lg:block xl:hidden">lg</div>
|
||||
<div className="hidden xl:block 2xl:hidden">xl</div>
|
||||
<div className="hidden 2xl:block xxl:hidden">2xl</div>| {mediaSize}
|
||||
px
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user