Next.js Discord

Discord Forum

hey i need help

Unanswered
Netherland Dwarf posted this in #help-forum
Open in Discord
Netherland DwarfOP
i have recently learned next js and i just wanted to make a simple layout like this
but when i am making same thing in next js everything is collapsing and i dont know the reason
can anybody look ?
this is my layout code
return (
    <html lang="en">
      <body
        className={`${geistSans.variable} ${geistMono.variable} antialiased bg-white text-gray-900 h-full`}
      >
        
        <div className="min-h-screen flex flex-col">
          <ClerkProvider>
         

          <header className="border border-black p-4">
            <h1 className="text-xl font-bold">Header</h1>
          </header>

          {/* Body */}
          <div className="flex flex-1">
            {/* Sidebar */}
            <aside className="w-64 border border-black p-4">
              <p>Sidebar</p>
            </aside>

            {/* Main Content */}
            <main className="flex-1 border border-black p-4">
              {children}
            </main>
          
          </div>
           </ClerkProvider> 
        </div>
       
      </body>
    </html>
  );
}

....and it looks like the second picture

23 Replies

@Anay-208 have you installed tailwind
Netherland DwarfOP
yes
it is configured properly
@Anay-208 have you installed tailwind
Netherland DwarfOP
if u have time can you come to vc and look ?
@Netherland Dwarf if u have time can you come to vc and look ?
not now, I'm available in <t:1774891800:R>
@Anay-208 not now, I'm available in <t:1774891800:R>
Netherland DwarfOP
ok i will ping you after 6 hours
@Netherland Dwarf if u have time can you come to vc and look ?
instead of this, send your globals.css
@Netherland Dwarf i have recently learned next js and i just wanted to make a simple layout like this but when i am making same thing in next js everything is collapsing and i dont know the reason can anybody look ? this is my layout code jsx return ( <html lang="en"> <body className={`${geistSans.variable} ${geistMono.variable} antialiased bg-white text-gray-900 h-full`} > <div className="min-h-screen flex flex-col"> <ClerkProvider> <header className="border border-black p-4"> <h1 className="text-xl font-bold">Header</h1> </header> {/* Body */} <div className="flex flex-1"> {/* Sidebar */} <aside className="w-64 border border-black p-4"> <p>Sidebar</p> </aside> {/* Main Content */} <main className="flex-1 border border-black p-4"> {children} </main> </div> </ClerkProvider> </div> </body> </html> ); } ....and it looks like the second picture
im not sure if you use some linter but you should use one. The code you paste is wrong (comments are all wrong)
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";

const geistSans = Geist({
  variable: "--font-geist-sans",
  subsets: ["latin"],
});

const geistMono = Geist_Mono({
  variable: "--font-geist-mono",
  subsets: ["latin"],
});

export const metadata = {
  title: "Create Next App",
  description: "Generated by create next app",
};
import { ClerkProvider, Show, SignInButton, SignUpButton, UserButton } from '@clerk/nextjs'
export default function RootLayout({ children }) {
  return (
    <html
      lang="en"
      className={`${geistSans.variable} ${geistMono.variable} h-full antialiased`}
    >
      <body className="min-h-full flex flex-col">
        <div className="min-h-screen flex flex-col">
          <ClerkProvider>
          <header className="border border-black p-4">
            <h1 className="text-xl font-bold">Header</h1>
          </header>
          {/* Body */}
          <div className="flex flex-1">
            {/* Sidebar */}
            <aside className="w-64 border border-black p-4">
              <p>Sidebar</p>
            </aside>
            {/* Main Content */}
            <main className="flex-1 border border-black p-4">{children}</main>
          </div>
          </ClerkProvider>
        </div>
      </body>
    </html>
  );
}
that code works
the comments are right, nothing seems wrong in it
Like this {/* Main Content */}, its correct
@Anay-208 The layout code is fine if everything is imported
this is wrong
and look biome clearly is wrong
@Nuitari this is wrong
You are seeing this because you are just viewing the message as it is, you have to copy it. its just discord formatting
you have to right click -> copy
the message
i did copy and paste
for next time.
oh ok i see XDD
didnt even knew discord eat characters i always format code
ya