Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

レスポンシブ Feature/responsive #56

Merged
merged 13 commits into from
Oct 5, 2024
5 changes: 1 addition & 4 deletions app/(auth)/login/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type {Metadata} from 'next'
import {Noto_Sans_JP} from 'next/font/google'
import {AppRouterCacheProvider} from '@mui/material-nextjs/v14-appRouter';
import {CssBaseline, ThemeProvider} from "@mui/material";
import {theme} from "@/components/theme/theme"
import {CssBaseline} from "@mui/material";

const noto = Noto_Sans_JP({
weight: ['400', '500', '600', '700'],
Expand All @@ -23,10 +22,8 @@ export default function RootLayout({
<html lang="ja">
<body className={noto.className}>
<AppRouterCacheProvider>
<ThemeProvider theme={theme}>
<CssBaseline/>
{children}
</ThemeProvider>
</AppRouterCacheProvider>
</body>
</html>
Expand Down
33 changes: 27 additions & 6 deletions app/(auth)/login/page.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,37 @@
'use client'
import {Button, Stack, Typography} from "@mui/material";
import LoginButton from "@/components/auth/LoginButton";
import Image from "next/image";
import WiderLogo from "@/components/svg/wider";
import Link from "next/link";
import PrivacyPolicyDrawer from "@/components/layout/privacyPolicyDrawer";
import {useTheme} from "@mui/material/styles";
import Logo from "@/public/logo/logo.svg";
import * as React from "react";

export default function Login() {
const theme = useTheme();
return (
<Stack height="100vh" width="100vw" justifyContent="center" alignItems="center" sx={{background:"radial-gradient(ellipse at left, #5F6DC2, #3E4EB3)"}}>
<Stack justifyContent="center" alignItems="center" spacing={1.5}>
<Image src={"/logo/logo_admin.png"} height={"24"} width={"302"} alt={"SPORTSDAY Admin"}/>
<Typography pb={3} fontSize={"14px"} fontWeight={"600"} color={"#EFF0F8"}>球技大会の進行管理アプリケーション</Typography>
<Stack height="100vh" width="100vw" justifyContent="center" alignItems="center" sx={{background: `linear-gradient(${theme.palette.secondary.light}, ${theme.palette.secondary.dark})`,}}>
<Stack justifyContent="center" alignItems="center" spacing={1.5} maxWidth={"600px"} width={"100%"} px={2}>
<Stack
direction={"row"}
spacing={1}
sx={{
cursor: "pointer",
justifyContent: "center",
alignItems: "center",
color: theme.palette.text.primary,
textDecoration: "none"
}}
>
<Logo width={18 * 8.45} height={18} fill={theme.palette.text.primary}/>
<Typography
color={"text.primary"} fontWeight={"bold"} pt={0.15}
fontSize={"18px"}
sx={{textTransform: "none"}}
>Admin
</Typography>
</Stack>
<Typography pb={3} fontSize={"20px"} fontWeight={"600"}>球技大会の進行管理アプリケーション</Typography>
<LoginButton/>
<PrivacyPolicyDrawer/>
<Typography fontSize={"13px"} fontWeight={"400"} color={"#9aa6e5"}>SPORTSDAYを使うにはCookieが必要です</Typography>
Expand Down
35 changes: 10 additions & 25 deletions app/(authenticated)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,7 @@
import type {Metadata} from 'next'
import {Noto_Sans_JP} from 'next/font/google'
import {AppRouterCacheProvider} from '@mui/material-nextjs/v14-appRouter';
import {CssBaseline, ThemeProvider, Box, Stack} from "@mui/material";
import {theme} from "@/components/theme/theme"
import {CssBaseline, Box, Stack} from "@mui/material";
import {Navigation} from "@/components/layout/navigation";

const noto = Noto_Sans_JP({
weight: ['400', '500', '600', '700'],
subsets: ['latin'],
variable: '--font-noto-sans-jp',
});

export const metadata: Metadata = {
title: 'Sports-day Admin',
}
Expand All @@ -21,20 +12,14 @@ export default function RootLayout({
children: React.ReactNode
}) {
return (
<html lang="ja">
<body className={noto.className}>
<AppRouterCacheProvider>
<ThemeProvider theme={theme}>
<CssBaseline/>
<Box sx={{ display: 'flex' }}>
<Navigation/>
<Stack minHeight="100lvh-8" width="100%" mt={8}>
{children}
</Stack>
</Box>
</ThemeProvider>
</AppRouterCacheProvider>
</body>
</html>
<>
<CssBaseline/>
<Box sx={{ display: 'flex' }}>
<Navigation/>
<Stack minHeight="100lvh-8" width="100%" mt={8}>
{children}
</Stack>
</Box>
</>
)
}
2 changes: 1 addition & 1 deletion app/(authenticated)/loading.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export default function Loading() {

return(
<>
<Backdrop open={backdropOpen} sx={{backgroundColor:"rgba(239,240,248, 0.4)", zIndex: 1}}/>
<Backdrop open={backdropOpen} sx={{backgroundColor:"rgba(45,52,98,0.3)", zIndex: 1}}/>
<Stack spacing={2} mx={2} my={3}>
<Skeleton animation="wave" variant="text" width={300} height={18} />
<CardBackground>
Expand Down
2 changes: 1 addition & 1 deletion app/(authenticated)/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Breadcrumbs, Grid, Stack, Typography} from "@mui/material"
import {Breadcrumbs, Grid, Stack, Typography, useTheme} from "@mui/material"
import CardBackground from "@/components/layout/cardBackground"
import CardLarge from "@/components/layout/cardLarge"
import SportsList from "@/components/sports/sportsList"
Expand Down
14 changes: 8 additions & 6 deletions app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import type {Metadata} from 'next'
import {Noto_Sans_JP} from 'next/font/google'
import {AppRouterCacheProvider} from '@mui/material-nextjs/v14-appRouter';
import {CssBaseline, ThemeProvider} from "@mui/material";
import {theme} from "@/components/theme/theme"
import {CssBaseline} from "@mui/material";
import ColorModeProvider from "@/components/theme/colorModeProvider";

const noto = Noto_Sans_JP({
weight: ['400', '500', '600', '700'],
Expand All @@ -22,12 +22,14 @@ export default function RootLayout({
return (
<html lang="ja">
<body className={noto.className}>

<AppRouterCacheProvider>
<ThemeProvider theme={theme}>
<CssBaseline/>
{children}
</ThemeProvider>
<ColorModeProvider>
<CssBaseline/>
{children}
</ColorModeProvider>
</AppRouterCacheProvider>

</body>
</html>
)
Expand Down
12 changes: 8 additions & 4 deletions components/auth/LoginButton.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
'use client'
import {Button} from "@mui/material";
import {Button, Typography} from "@mui/material";
import crypto from 'crypto';
import * as querystring from "querystring";
import {useEffect, useState} from "react";
import {useTheme} from "@mui/material/styles";

export default function LoginButton() {
const [authorizationUrl, setAuthorizationUrl] = useState<string>('')
const theme = useTheme()

useEffect(() => {
const authorizationBaseUrl = process.env.NEXT_PUBLIC_OIDC_AUTHORIZE_URL
Expand Down Expand Up @@ -37,12 +39,14 @@ export default function LoginButton() {
return (
<Button
variant="contained"
color="secondary"
color="primary"
href={authorizationUrl}
sx={{py:1.5, width:"100%"}}
sx={{px:3, py:1.5, width:"100%", backgroundColor:`${theme.palette.text.primary}`}}
disableElevation
>
{buttonDisplayName}
<Typography fontSize={"14px"} color={theme.palette.background.paper}>
{buttonDisplayName}
</Typography>
</Button>
);
}
4 changes: 3 additions & 1 deletion components/auth/LogoutButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ import {IconButton, Tooltip} from "@mui/material";
import Cookies from "js-cookie";
import {useRouter} from "next/navigation";
import {HiArrowRightOnRectangle} from "react-icons/hi2";
import {useTheme} from "@mui/material/styles";

export default function LogoutButton() {
const router = useRouter()
const theme = useTheme()

return (
<Tooltip title={"ログアウト"}>
Expand All @@ -18,7 +20,7 @@ export default function LogoutButton() {
}}
sx={{width:"fit-content"}}
>
<HiArrowRightOnRectangle color={"#eff0f8"}/>
<HiArrowRightOnRectangle color={theme.palette.text.secondary}/>
</IconButton>
</Tooltip>
);
Expand Down
7 changes: 5 additions & 2 deletions components/layout/buttonLarge.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {Avatar, Button, Stack, Grid} from "@mui/material";
import {Avatar, Button, Stack, Grid, Typography} from "@mui/material";
import React, {ReactNode} from "react";

type ButtonLargeProps = {
Expand All @@ -11,6 +11,7 @@ export const ButtonLarge: React.FC<ButtonLargeProps> = ({img, children, link})=>
return(
<Grid item xs={12} sm={6} md={4} lg={3}>
<Button
color={"secondary"}
variant={"contained"}
sx={{width:"100%"}}
href={link}
Expand All @@ -27,7 +28,9 @@ export const ButtonLarge: React.FC<ButtonLargeProps> = ({img, children, link})=>
src={img}
>
</Avatar>}
{children}
<Typography fontSize={"inherit"} color={"text.primary"}>
{children}
</Typography>
</Stack>
</Button>
</Grid>
Expand Down
18 changes: 14 additions & 4 deletions components/layout/cardBackground.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import {Button, Card, Stack, Typography} from "@mui/material";
import {Button, Card, Stack, Typography, useTheme} from "@mui/material";
import React, {ReactNode} from 'react';
import {red} from "@mui/material/colors";

type CardProps = {
title?: string;
Expand All @@ -10,18 +11,27 @@ type CardProps = {
};

const CardBackground: React.FC<CardProps> = ({title, button, link, children, onClick}) => {

return (
<>
<Card sx={{py: 2, px: 2}}>
<Card
sx={{
py: 2, px: 2,
backgroundImage:`linear-gradient(rgba(105,112,164,0), rgba(47,60,140,0.08))`
}}
>
<Stack pb={2} spacing={1} direction={"row"} justifyContent={"flex-start"} alignItems="center">
{title && <Typography color={"primary.light"}>{title}</Typography>}
{title && <Typography color={"text.primary"}>{title}</Typography>}
{button &&
<Button
color={"secondary"}
variant={"contained"}
href={link}
onClick={onClick}
>
{button}
<Typography fontSize={"inherit"} color={"text.primary"}>
{button}
</Typography>
</Button>
}
</Stack>
Expand Down
6 changes: 3 additions & 3 deletions components/layout/cardLarge.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ type CardProps = {
const CardLarge: React.FC<CardProps> = ({ children }) => {
return (
<>
<Card sx={{py:1.5, px:2, backgroundColor:"primary.main", color:"secondary.main"}}>
<Card sx={{py:1.5, px:2, backgroundColor:"secondary.main", color:"text.primary"}}>
<Stack spacing={1} direction={"row"} justifyContent={"flex-start"} alignItems="center">
<Avatar sx={{height:"1.5em", width:"1.5em", backgroundColor:"primary.dark"}}>
<HiMegaphone/>
<Avatar sx={{height:"1.5em", width:"1.5em", backgroundColor:"text.secondary"}}>
<HiMegaphone color={"secondary.main"}/>
</Avatar>
<Typography>{children}</Typography>
</Stack>
Expand Down
15 changes: 15 additions & 0 deletions components/layout/logo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import Image from "next/image";
import PropTypes from "prop-types";

export const SDLogo = (props: any) => {
const {w} = props;
return (
<>
<Image src={"public/logo.svg"} alt="logo" height={w*8.45} width={w} priority />
</>
);
};

SDLogo.propTypes = {
w: PropTypes.object
};
6 changes: 4 additions & 2 deletions components/layout/navPrivacyPolicyDrawer.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
'use client'
import {Container, Button, AppBar, Box, SwipeableDrawer, IconButton, Tooltip, BottomNavigation,} from "@mui/material";
import {Container, Button, Box, SwipeableDrawer, IconButton, Tooltip, BottomNavigation,} from "@mui/material";
import React from 'react';
import {HiBuildingLibrary, HiXMark} from "react-icons/hi2";
import PrivacyPolicy from "@/components/layout/privacyPolicy";
import {useTheme} from "@mui/material/styles";

const NavPrivacyPolicyDrawer = () => {
const [open, setOpen] = React.useState(false);
const theme = useTheme()

const toggleDrawer = (newOpen: boolean) => () => {
setOpen(newOpen);
Expand Down Expand Up @@ -59,7 +61,7 @@ const NavPrivacyPolicyDrawer = () => {
<IconButton
onClick={toggleDrawer(true)}
>
<HiBuildingLibrary color={"#eff0f8"}/>
<HiBuildingLibrary color={theme.palette.text.secondary}/>
</IconButton>
</Tooltip>
<SwipeableDrawer
Expand Down
Loading
Loading