Skip to content

Commit

Permalink
Feat: Add dark mode package and entire set of updated layout components
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohmdev authored Oct 2, 2024
1 parent 28b1ae5 commit 661f164
Show file tree
Hide file tree
Showing 66 changed files with 6,783 additions and 10,353 deletions.
8,335 changes: 1,737 additions & 6,598 deletions package-lock.json

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,25 @@
"@meilisearch/instant-meilisearch": "^0.7.1",
"@paypal/paypal-js": "^5.0.6",
"@paypal/react-paypal-js": "^7.8.1",
"@radix-ui/react-aspect-ratio": "^1.1.0",
"@radix-ui/react-hover-card": "^1.1.2",
"@radix-ui/react-icons": "^1.3.0",
"@radix-ui/react-menubar": "^1.1.2",
"@radix-ui/react-navigation-menu": "^1.2.1",
"@radix-ui/react-progress": "^1.1.0",
"@radix-ui/react-scroll-area": "^1.2.0",
"@radix-ui/react-separator": "^1.1.0",
"@radix-ui/react-slider": "^1.2.1",
"@radix-ui/react-toggle": "^1.1.0",
"@stripe/react-stripe-js": "^1.7.2",
"@stripe/stripe-js": "^1.29.0",
"algoliasearch": "^4.20.0",
"axios": "^1.6.7",
"class-variance-authority": "^0.7.0",
"embla-carousel-react": "^8.3.0",
"framer-motion": "^11.9.0",
"lodash": "^4.17.21",
"lucide-react": "^0.447.0",
"next": "^14.0.0",
"next-themes": "^0.3.0",
"pg": "^8.11.3",
Expand Down
17 changes: 5 additions & 12 deletions src/app/[countryCode]/(main)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,12 @@
import { Metadata } from "next"
import { Metadata } from 'next'

import Footer from "@/modules/layout/templates/footer"
import Nav from "@/modules/layout/templates/nav"
import { getBaseURL } from "@/lib/util/env"
import { getBaseURL } from '@/lib/util/env'
import LayoutTemplate from '@/modules/layout'

export const metadata: Metadata = {
metadataBase: new URL(getBaseURL()),
}

export default async function PageLayout(props: { children: React.ReactNode }) {
return (
<>
<Nav />
{props.children}
<Footer />
</>
)
export default function PageLayout(props: { children: React.ReactNode }) {
return <LayoutTemplate>{props.children}</LayoutTemplate>
}
18 changes: 14 additions & 4 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@
import { getBaseURL } from "@/lib/util/env"
import { Metadata } from "next"
import { getBaseURL } from '@/lib/util/env'
import { Metadata } from 'next'
import '@/styles/base.css'
import '@/styles/utilities.css'
import '@/styles/components.css'
import '@/styles/custom.css'
import { ThemeProvider } from '@/ui/theme-provider'

export const metadata: Metadata = {
metadataBase: new URL(getBaseURL()),
}

export default function RootLayout(props: { children: React.ReactNode }) {
return (
<html lang="en" data-mode="light">
<html lang="en" data-mode="dark">
<body>
<main className="relative">{props.children}</main>
<ThemeProvider
attribute="class"
defaultTheme="system"
enableSystem
// disableTransitionOnChange
>
<main className="relative grid min-h-screen grid-rows-[max-content_1fr_max-content]">
{props.children}
</main>
</ThemeProvider>
</body>
</html>
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
import { notFound } from "next/navigation"
import CartDropdown from "../cart-dropdown"
import { enrichLineItems, retrieveCart } from "@/lib/data/cart"

const fetchCart = async () => {
const cart = await retrieveCart()

if (!cart) {
return null
}

if (cart?.items?.length) {
const enrichedItems = await enrichLineItems(cart.items, cart.region_id!)
cart.items = enrichedItems
}

return cart
}

export default async function CartButton() {
const cart = await fetchCart()

return <CartDropdown cart={cart} />
}
// import { notFound } from 'next/navigation'
import { enrichLineItems, retrieveCart } from '@/lib/data/cart'
import CartDropdown from '../cart-dropdown'

const fetchCart = async () => {
const cart = await retrieveCart()

if (!cart) {
return null
}

if (cart?.items?.length) {
const enrichedItems = await enrichLineItems(cart.items, cart.region_id!)
cart.items = enrichedItems
}

return cart
}

export default async function CartButton() {
const cart = await fetchCart()

return <CartDropdown cart={cart} />
}
Loading

0 comments on commit 661f164

Please sign in to comment.