From babc7f152696f82b508639a9cfc2e9605defaa8b Mon Sep 17 00:00:00 2001 From: porink0424 Date: Thu, 26 Oct 2023 04:23:06 +0900 Subject: [PATCH] For responsive: css --- app/_components/Footer.tsx | 8 +-- app/_components/Header.tsx | 85 +++++++++++++---------- app/_components/sections/SectionAbout.tsx | 8 ++- app/_components/sections/SectionTop.tsx | 20 ++++-- app/layout.tsx | 8 +-- app/page.tsx | 6 +- 6 files changed, 76 insertions(+), 59 deletions(-) diff --git a/app/_components/Footer.tsx b/app/_components/Footer.tsx index f688821..8248d31 100644 --- a/app/_components/Footer.tsx +++ b/app/_components/Footer.tsx @@ -1,6 +1,6 @@ 'use client' -import { Box, Group, Space, Stack, Text } from '@mantine/core' +import { Box, Flex, Space, Stack, Text } from '@mantine/core' import { useElementSize } from '@mantine/hooks' import SnsIcons from './SnsIcons' @@ -11,15 +11,15 @@ export default function Footer() { <> - + {['About', 'Experiences', 'Research', 'Hobby'].map((text, index) => ( {text} ))} - + - + diff --git a/app/_components/Header.tsx b/app/_components/Header.tsx index 2691f5d..88920fd 100644 --- a/app/_components/Header.tsx +++ b/app/_components/Header.tsx @@ -71,54 +71,63 @@ export default function Header() { const activeSection = useAtomValue(activeSectionAtom) const [open, setOpen] = useAtom(menuOpenAtom) const isMobile = useMediaQuery('(max-width: 768px)') + const isSmallMobile = useMediaQuery('(max-width: 480px)') const toggleOpen = useCallback(() => { setOpen((prev) => !prev) }, [setOpen]) - if (isMobile === undefined) return null - return ( - {isMobile ? ( - - - - - - - + { + // eslint-disable-next-line no-nested-ternary + isMobile === undefined ? null : isMobile ? ( + + + + + + {!isSmallMobile && ( + + + + )} - - ) : ( - <> - - - - + ) : ( + <> + + + + - - {['About', 'Experiences', 'Research', 'Hobby'].map((text, index) => ( - - {index > 0 && } - - {text} - - - ))} - - - )} + + {['About', 'Experiences', 'Research', 'Hobby'].map((text, index) => ( + + {index > 0 && } + + {text} + + + ))} + + + ) + } ) diff --git a/app/_components/sections/SectionAbout.tsx b/app/_components/sections/SectionAbout.tsx index 816fab2..e955814 100644 --- a/app/_components/sections/SectionAbout.tsx +++ b/app/_components/sections/SectionAbout.tsx @@ -2,6 +2,8 @@ import { Language } from '@/app/_constants/language' import { SECTION_ABOUT } from '@/app/_contents/SectionAbout' import { Text, Title, Stack, List, ListItem, Timeline, TimelineItem, Box } from '@mantine/core' import React from 'react' +import { Point } from 'tabler-icons-react' +import { parseText } from '@/app/_utils/parseText' import SnsIcons from '../SnsIcons' type Props = { @@ -21,9 +23,11 @@ function SectionAbout({ language, sectionRef }: Props) { Profile - + {SECTION_ABOUT.profile[language].map((text, index) => ( - {text} + } key={index} className='flex items-center'> + {parseText(text)} + ))} diff --git a/app/_components/sections/SectionTop.tsx b/app/_components/sections/SectionTop.tsx index 2312491..8bd8908 100644 --- a/app/_components/sections/SectionTop.tsx +++ b/app/_components/sections/SectionTop.tsx @@ -1,4 +1,6 @@ -import { Box, Overlay, Image, Group, Avatar, Title, Text, AspectRatio } from '@mantine/core' +'use client' + +import { Box, Overlay, Image, Avatar, Title, Text, AspectRatio } from '@mantine/core' import React from 'react' function SectionTop() { @@ -13,15 +15,21 @@ function SectionTop() { - - + + - + <Title order={1} className='!text-2xl sm:!text-5xl text-center sm:text-left'> Daichi Kato - M1 Student at The University of Tokyo, Japan + + M1 Student at The University of Tokyo, Japan + - + ) diff --git a/app/layout.tsx b/app/layout.tsx index 5cada89..7626c6d 100644 --- a/app/layout.tsx +++ b/app/layout.tsx @@ -1,7 +1,7 @@ import type { Metadata } from 'next' import './globals.css' import '@mantine/core/styles.css' -import { AppShell, AppShellMain, Box, ColorSchemeScript, MantineProvider } from '@mantine/core' +import { AppShell, AppShellMain, ColorSchemeScript, MantineProvider } from '@mantine/core' import { Noto_Sans_JP } from 'next/font/google' import Header from './_components/Header' import Footer from './_components/Footer' @@ -23,11 +23,7 @@ function PageLayout({ children }: { children: React.ReactNode }) { return (
- - - {children} - - + {children}