Skip to content

Commit

Permalink
fix(web): full height (#3277)
Browse files Browse the repository at this point in the history
  • Loading branch information
ykzts authored Mar 15, 2024
1 parent 9b83543 commit c7a0492
Show file tree
Hide file tree
Showing 18 changed files with 70 additions and 61 deletions.
5 changes: 0 additions & 5 deletions apps/web/app/(content)/@title/about/page.tsx

This file was deleted.

3 changes: 0 additions & 3 deletions apps/web/app/(content)/@title/default.ts

This file was deleted.

10 changes: 0 additions & 10 deletions apps/web/app/(content)/@title/kuji/[id]/loading.tsx

This file was deleted.

13 changes: 0 additions & 13 deletions apps/web/app/(content)/@title/kuji/[id]/page.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions apps/web/app/(content)/@title/privacy/page.tsx

This file was deleted.

6 changes: 5 additions & 1 deletion apps/web/app/(content)/about/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type Metadata } from 'next'
import { type ReactNode } from 'react'
import SimpleTitle from '@/components/simple-title'
import { title as siteName, twitterAccount } from '@/lib/constants'

export const metadata = {
Expand All @@ -25,6 +26,9 @@ type Props = {

export default function AboutLayout({ children }: Props) {
return (
<div className="prose prose-invert prose-orange max-w-none">{children}</div>
<div className="prose prose-invert prose-orange max-w-none [&_em]:font-semibold [&_em]:not-italic">
<SimpleTitle>{siteName}とは</SimpleTitle>
{children}
</div>
)
}
5 changes: 5 additions & 0 deletions apps/web/app/(content)/kuji/[id]/loading.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
import Skeleton from '@inaba-jinja/components/skeleton'
import SimpleTitle from '@/components/simple-title'

export default function KujiLoading() {
return (
<>
<SimpleTitle>
<Skeleton className="h-4 w-24" />
</SimpleTitle>

<div className="flex items-center justify-center">
<Skeleton className="block h-[540px] w-[254px]" />
</div>
Expand Down
3 changes: 3 additions & 0 deletions apps/web/app/(content)/kuji/[id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { type Metadata } from 'next'
import Image from 'next/image'
import { notFound } from 'next/navigation'
import SimpleTitle from '@/components/simple-title'
import { title as siteName, twitterAccount } from '@/lib/constants'
import { type FortuneEntry, getFortune, getFortuneIDs } from '@/lib/contentful'
import { generateFortuneName, getImageURL } from '@/lib/fortune'
Expand Down Expand Up @@ -89,6 +90,8 @@ export default async function Page({ params }: Props) {

return (
<>
<SimpleTitle>{name}</SimpleTitle>

<div className="flex items-center justify-center">
<Image
alt={name}
Expand Down
8 changes: 3 additions & 5 deletions apps/web/app/(content)/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,11 @@ import { title as siteName } from '@/lib/constants'

type Props = {
children: ReactNode
title: ReactNode
}

export default function ContentLayout({ children, title }: Props) {
export default function ContentLayout({ children }: Props) {
return (
<div className="mx-auto w-full max-w-screen-md py-4 text-slate-100">
<div className="mx-auto grid h-full w-full max-w-screen-md grid-rows-[auto_1fr] py-4 text-slate-100">
<header className="px-2">
<Link href="/">
<Logo
Expand All @@ -21,8 +20,7 @@ export default function ContentLayout({ children, title }: Props) {
</header>

<main className="px-2 pt-4">
<div className="rounded-2xl bg-slate-900/70 p-4 pb-8">
{title}
<div className="h-full rounded-2xl bg-slate-900/70 p-4 pb-8">
{children}
</div>
</main>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/app/(content)/lottery/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function LotteryPage() {
const idPromise = getAnyFortuneID()

return (
<div className="mb-4 mt-8 flex flex-col items-center justify-center">
<div className="mb-4 mt-8 flex h-full flex-col items-center justify-center">
<Suspense fallback={null}>
<Redirect idPromise={idPromise} />
</Suspense>
Expand Down
6 changes: 5 additions & 1 deletion apps/web/app/(content)/privacy/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { type Metadata } from 'next'
import { type ReactNode } from 'react'
import SimpleTitle from '@/components/simple-title'
import { title as siteName, twitterAccount } from '@/lib/constants'

export const metadata = {
Expand All @@ -25,6 +26,9 @@ type Props = {

export default function PrivacyLayout({ children }: Props) {
return (
<div className="prose prose-invert prose-orange max-w-none">{children}</div>
<div className="prose prose-invert prose-orange max-w-none">
<SimpleTitle>プライバシーポリシー</SimpleTitle>
{children}
</div>
)
}
14 changes: 12 additions & 2 deletions apps/web/app/_components/mobile-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,22 @@ import {
DialogTrigger
} from '@radix-ui/react-dialog'
import Link from 'next/link'
import { twMerge } from 'tailwind-merge'
import Logo from '@/components/logo.svg'

export default function MobileMenu() {
type Props = {
className?: string
}

export default function MobileMenu({ className }: Props) {
return (
<Dialog>
<DialogTrigger className="supports-[right:env(safe-area-inset-right)]:right-[env(safe-area-inset-right, 0)] fixed right-0 top-0 m-2 w-10 space-y-1.5 p-2 text-slate-100 supports-[top:env(safe-area-inset-top)]:top-[env(safe-area-inset-top,0)] md:hidden">
<DialogTrigger
className={twMerge(
'm-2 w-10 space-y-1.5 p-2 text-slate-100',
className
)}
>
<span
aria-hidden
className="block h-0.5 w-full rounded-full bg-current"
Expand Down
8 changes: 4 additions & 4 deletions apps/web/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ export default function RootLayout({ children }: Props) {
<html lang="ja">
<head prefix="og: http://ogp.me/ns#" />
<body>
<div className="pl-[env(safe-area-inset-left,0)] pr-[env(safe-area-inset-right,0)] pt-[env(safe-area-inset-top,0)] md:grid md:min-h-dvh md:grid-rows-[1fr_auto]">
<MobileMenu />
<div className="md:grid md:min-h-dvh md:grid-rows-[1fr_auto]">
<MobileMenu className="supports-[right:env(safe-area-inset-right)]:right-safe supports-[top:env(safe-area-inset-top)]:top-safe fixed right-0 top-0 md:hidden" />

{children}
<div className="pl-safe pr-safe pt-safe">{children}</div>

<footer className="hidden bg-black/80 pb-[env(safe-area-inset-bottom,0)] text-sm text-slate-100 md:block">
<footer className="pb-safe pl-safe pr-safe hidden bg-black/80 text-sm text-slate-100 md:block">
<nav className="p-4">
<ul className="flex items-center justify-end gap-4">
<li>
Expand Down
3 changes: 2 additions & 1 deletion apps/web/app/not-found.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ export const metadata: Metadata = {

export default function Page() {
return (
<ContentLayout title={<SimpleTitle>{title}</SimpleTitle>}>
<ContentLayout>
<SimpleTitle>{title}</SimpleTitle>
<p>申し訳ありませんがお探しのページを見つけられませんでした。</p>
</ContentLayout>
)
Expand Down
5 changes: 3 additions & 2 deletions packages/tailwind-config/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@
"url": "https://github.com/inabagumi/inaba-jinja/issues"
},
"dependencies": {
"tailwindcss": "^3.4.1"
"@tailwindcss/typography": "^0.5.10",
"tailwindcss": "^3.4.1",
"tailwindcss-safe-area": "^0.5.1"
},
"description": "This is a tailwind.config for Inaba Jinja.",
"devDependencies": {
"@tailwindcss/typography": "^0.5.10",
"@tsconfig/node20": "^20.1.2",
"@tsconfig/strictest": "^2.0.3",
"tsup": "^8.0.2"
Expand Down
3 changes: 2 additions & 1 deletion packages/tailwind-config/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import typographyPlugin from '@tailwindcss/typography'
import { type Config } from 'tailwindcss'
import { fontFamily as defaultFontFamily } from 'tailwindcss/defaultTheme.js'
import safeAreaPlugin from 'tailwindcss-safe-area'

const tailwindConfig: Config = {
content: [],
plugins: [typographyPlugin],
plugins: [typographyPlugin, safeAreaPlugin],
theme: {
fontFamily: {
...defaultFontFamily,
Expand Down
7 changes: 7 additions & 0 deletions packages/tailwind-config/src/plugins.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
declare module 'tailwindcss-safe-area' {
import { type PluginCreator } from 'tailwindcss'

const plugin: PluginCreator

export default plugin
}
25 changes: 18 additions & 7 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c7a0492

Please sign in to comment.