Skip to content

Commit

Permalink
Merge pull request #7 from GaoNeng-wWw/main
Browse files Browse the repository at this point in the history
fix: header footer 错误
  • Loading branch information
SnowballXueQiu authored Aug 16, 2024
2 parents d91ee3e + e355be6 commit 629b01a
Show file tree
Hide file tree
Showing 36 changed files with 153 additions and 201 deletions.
27 changes: 14 additions & 13 deletions app/layout.tsx → app/(index)/layout.tsx
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

import '@mantine/core/styles.css';
import React from 'react';
import {MantineProvider, ColorSchemeScript, AppShell, ScrollArea} from '@mantine/core';
import { MantineProvider, ColorSchemeScript, AppShell } from '@mantine/core';
import { Notifications } from '@mantine/notifications';
import { theme } from '../theme';
import { theme } from '@/theme';
import '@mantine/notifications/styles.css';
import Header from "@/app/components/Header";
import Footer from "@/app/components/Footer";
import Header from '@/components/Header';
import Footer from '@/components/Footer';

export default function RootLayout({ children }: { children: any }) {
return (
Expand All @@ -21,22 +21,23 @@ export default function RootLayout({ children }: { children: any }) {
/>
<title>苦力怕论坛 | 问卷系统</title>
</head>
<body>
<body style={{
overflow: 'hidden',
}}>
<MantineProvider theme={theme}>
<Notifications position="top-right" />
<AppShell>
<AppShell.Header h={56}>
<AppShell
header={{ height: 60 }}
>
<AppShell.Header>
<Header />
</AppShell.Header>

<AppShell.Main>
{/*<ScrollArea>*/}
{children}
{/*</ScrollArea>*/}
{children}
</AppShell.Main>

<AppShell.Footer mah={154}>
<Footer />
<AppShell.Footer mah={120}>
<Footer />
</AppShell.Footer>
</AppShell>
</MantineProvider>
Expand Down
74 changes: 36 additions & 38 deletions app/page.tsx → app/(index)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import { Button, Center, Container, Group, Image, SimpleGrid, Space, Stack, Text, Title } from '@mantine/core';
import { useRouter } from 'next/navigation';
import { min } from '@floating-ui/utils';
import classes from '@/app/oauth/components/LoginBanner.module.css';
import SurveyCard from '@/app/components/SurveyCard';
import mainPageImage from '@/public/main-page.svg';
import classes from '@/styles/common.module.css';
import SurveyCard from '@/components/SurveyCard';
import Footer from '@/components/Footer';

export type Survey = {
title: string;
Expand Down Expand Up @@ -46,10 +46,9 @@ export default function HomePage() {
<>
<div
style={{
scrollSnapType: 'y mandatory',
overflowY: 'scroll',
height: '100vh',
paddingTop: '60px',
scrollSnapType: 'y mandatory',
overflowY: 'scroll',
height: '100vh',
}}
>
<Center
Expand All @@ -64,40 +63,38 @@ export default function HomePage() {
spacing="lg"
style={{ maxWidth: '80%', width: '100%' }}
>
<Center>
<Stack justify="center">
<Title className={classes.title}>
<Text span c="#008D57" inherit></Text>
<Text span c="#13AE67" inherit></Text>
<Text span c="#089946" inherit></Text>
论坛
</Title>
<Title>&#62; 问卷系统</Title>
<Text fw={500} fz="lg">收集更好的数据,作出更好的决策。</Text>
<Space h="md" />
<Group>
<Button
color="blue"
radius="md"
onClick={() => router.push('https://github.com/orgs/TeamVastsea/teams/klpbbs_survey')}
>
Github
</Button>
<Button
color="gray"
radius="md"
onClick={() => router.push('/oauth')}
>
立即使用
</Button>
</Group>
</Stack>
</Center>
<Stack justify="center">
<Title className={classes.title}>
<Text span c="#008D57" inherit></Text>
<Text span c="#13AE67" inherit></Text>
<Text span c="#089946" inherit></Text>
论坛
</Title>
<Title>&#62; 问卷系统</Title>
<Text fw={500} fz="lg">收集更好的数据,作出更好的决策。</Text>
<Space h="md" />
<Group>
<Button
color="blue"
radius="md"
onClick={() => router.push('https://github.com/orgs/TeamVastsea/teams/klpbbs_survey')}
>
Github
</Button>
<Button
color="gray"
radius="md"
onClick={() => router.push('/oauth')}
>
立即使用
</Button>
</Group>
</Stack>

<Container>
<Image
src={mainPageImage.src}
alt="Main Page Image"
src="favicon.svg"
alt="KLPBBS logo"
className={classes.image}
style={{ maxWidth: 380, margin: '0 auto' }}
/>
Expand All @@ -111,6 +108,7 @@ export default function HomePage() {
scrollSnapAlign: 'start',
scrollSnapStop: 'always',
}}
pb={120}
>
<Stack>
<Center>
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,24 @@ import {
IconClockHour5,

} from '@tabler/icons-react';
import classes from '@/app/backstage/components/NavBar.module.css';
import classes from './BadgeCard.module.css';

const data = [
{ link: '', label: '信息', icon: IconBellRinging },
{ link: '', label: '新建问卷', icon: IconPlus },
{ link: '', label: '最近', icon: IconClockHour5},
{ link: '', label: '与我合作', icon: IconUsersGroup }
{ link: '', label: '最近', icon: IconClockHour5 },
{ link: '', label: '与我合作', icon: IconUsersGroup },
];

export default function NavBar() {
const [active, setActive] = useState('Billing');
const links = data.map((item) => (
<a
className={classes.link}
data-active={item.label === active || undefined}
href={item.link}
key={item.label}
onClick={(event) => {
className={classes.link}
data-active={item.label === active || undefined}
href={item.link}
key={item.label}
onClick={(event) => {
event.preventDefault();
setActive(item.label);
}}
Expand Down Expand Up @@ -54,4 +54,4 @@ export default function NavBar() {
</div>
</nav>
);
}
}
11 changes: 6 additions & 5 deletions app/backstage/page.tsx → app/(root)/backstage/page.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
'use client';

import {
Grid,
SimpleGrid,
} from '@mantine/core';
import NavBar from "@/app/backstage/components/NavBar";
import Header from "@/app/components/Header"
import BadgeCard from "@/app/backstage/components/BadgeCard";
import "./Style.css"
import NavBar from './components/NavBar';
import Header from '@/components/Header';
import BadgeCard from './components/BadgeCard';
import './Style.css';

export default function BackStage() {
return (
Expand All @@ -24,4 +25,4 @@ export default function BackStage() {
</Grid>
</>
);
}
}
44 changes: 44 additions & 0 deletions app/(root)/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
'use client';

import '@mantine/core/styles.css';
import React from 'react';
import { MantineProvider, ColorSchemeScript, AppShell } from '@mantine/core';
import { Notifications } from '@mantine/notifications';
import { theme } from '@/theme';
import '@mantine/notifications/styles.css';
import Header from '@/components/Header';
import Footer from '@/components/Footer';

export default function RootLayout({ children }: { children: any }) {
return (
<html lang="en">
<head>
<ColorSchemeScript />
<link rel="shortcut icon" href="/favicon.svg" />
<meta
name="viewport"
content="minimum-scale=1, initial-scale=1, width=device-width, user-scalable=no"
/>
<title>苦力怕论坛 | 问卷系统</title>
</head>
<body>
<MantineProvider theme={theme}>
<Notifications position="top-right" />
<AppShell header={{ height: 60 }}>
<AppShell.Header>
<Header />
</AppShell.Header>

<AppShell.Main pb={120}>
{children}
</AppShell.Main>

<AppShell.Footer mah={120}>
<Footer />
</AppShell.Footer>
</AppShell>
</MantineProvider>
</body>
</html>
);
}
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { Center, Stack, Space } from '@mantine/core';
import { useSearchParams } from 'next/navigation';
import UserInfoCard from '@/app/oauth/callback/components/UserInfoCard';
import UserInfoCard from './components/UserInfoCard';

export default function CallbackPage() {
const searchParams = useSearchParams();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
@import url("@/styles/common.module.css");
.wrapper {
display: flex;
align-items: center;
Expand All @@ -21,14 +22,6 @@
}
}

.title {
color: light-dark(var(--mantine-color-black), var(--mantine-color-white));
font-family: "Greycliff CF",
var(--mantine-font-family), serif;
line-height: 1;
margin-bottom: var(--mantine-spacing-md);
}

.controls {
display: flex;
margin-top: var(--mantine-spacing-xl);
Expand Down
File renamed without changes.
File renamed without changes
2 changes: 1 addition & 1 deletion app/oauth/page.tsx → app/(root)/oauth/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { Center, Space, Stack } from '@mantine/core';
import { LoginBanner } from '@/app/oauth/components/LoginBanner';
import { LoginBanner } from './components/LoginBanner';

export default function OAuthPage() {
return (
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Space, Textarea } from '@mantine/core';
import React, { useRef } from 'react';
import { InputProps } from '@/app/survey/components/generateQuestion';
import type { InputProps } from './generateQuestion';

export function FillBlank(proos: InputProps) {
const ref = useRef<HTMLTextAreaElement>(null);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Checkbox, Group, Space, Stack, Text } from '@mantine/core';
import classes from './MultipleChoice.module.css';
import { ChoiceProps } from '@/app/survey/components/SingleChoice';
import { ChoiceProps } from './SingleChoice';

export function MultipleChoice(props: ChoiceProps) {
const data = props.choice;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Group, Radio, Space, Stack, Text } from '@mantine/core';
import classes from './SingleChoice.module.css';
import { InputProps, Value } from '@/app/survey/components/generateQuestion';
import type { InputProps, Value } from './generateQuestion';

export function SingleChoice(props: ChoiceProps) {
const data = props.choice;
Expand Down Expand Up @@ -33,6 +33,6 @@ export function SingleChoice(props: ChoiceProps) {
);
}

export interface ChoiceProps extends InputProps{
export interface ChoiceProps extends InputProps {
choice: Value[];
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
import React from 'react';
import { Text, Title } from '@mantine/core';
import { SingleChoice } from '@/app/survey/components/SingleChoice';
import { MultipleChoice } from '@/app/survey/components/MultipleChoice';
import { FileUpload } from '@/app/survey/components/FileUpload';
import { FillBlank } from '@/app/survey/components/FillBlank';
import { Title, Text } from '@mantine/core';
import { SingleChoice } from './SingleChoice';
import { MultipleChoice } from './MultipleChoice';
import { FileUpload } from './FileUpload';
import { FillBlank } from './FillBlank';

// eslint-disable-next-line max-len
export function generateQuestion(data: QuestionProps, value: string | undefined, setValue: (value: string) => void) {
export function generateQuestion(
data: QuestionProps,
value: string | undefined,
setValue: (value: string) => void
) {
switch (data.type) {
case 1:
return (
Expand Down
File renamed without changes.
16 changes: 16 additions & 0 deletions app/(root)/survey/layout.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export const metadata = {
title: 'Next.js',
description: 'Generated by Next.js',
};

export default function RootLayout({
children,
}: {
children: React.ReactNode
}) {
return (
<>
{ children }
</>
);
}
7 changes: 3 additions & 4 deletions app/survey/page.tsx → app/(root)/survey/page.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client';

import { useEffect, useState } from 'react';
import { Center, Title, Stack, Space } from '@mantine/core';
import { generateQuestion } from '@/app/survey/components/generateQuestion';
import questionsData from '@/app/survey/data/example.json';
import { Center, Title, Stack } from '@mantine/core';
import { generateQuestion } from './components/generateQuestion';
import questionsData from './data/example.json';

export default function Survey() {
const [questions, setQuestions] = useState<any[]>([]);
Expand All @@ -28,7 +28,6 @@ export default function Survey() {
{questions.map((question) => generateQuestion(question))}
</Stack>
</Center>
<Space h={100} />
</Stack>
);
}
Loading

0 comments on commit 629b01a

Please sign in to comment.