mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: home link
This commit is contained in:
1 parent
207b9ae36c
commit
5f3a1b1311
2 files changed
+16
-7
No files matched your search
@@ -23,7 +23,7 @@ import {
|
|||||||
import { usePathname } from 'next/navigation';
|
import { usePathname } from 'next/navigation';
|
||||||
import { useState } from 'react';
|
import { useState } from 'react';
|
||||||
import { REGIONS } from '../../constants/regions';
|
import { REGIONS } from '../../constants/regions';
|
||||||
import { TOOLS } from '../../constants/tools';
|
import { homeTool, TOOLS } from '../../constants/tools';
|
||||||
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
import { WARGAMING_APPLICATION_ID } from '../../constants/wargamingApplicationID';
|
||||||
import { imgur, ImgurSize } from '../../core/blitzkit/imgur';
|
import { imgur, ImgurSize } from '../../core/blitzkit/imgur';
|
||||||
import { patreonLoginUrl } from '../../core/blitzkit/patreonLoginUrl';
|
import { patreonLoginUrl } from '../../core/blitzkit/patreonLoginUrl';
|
||||||
@@ -39,6 +39,7 @@ export default function Navbar() {
|
|||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const logins = App.use((state) => state.logins);
|
const logins = App.use((state) => state.logins);
|
||||||
const mutateApp = App.useMutation();
|
const mutateApp = App.useMutation();
|
||||||
|
const tools = [homeTool, ...TOOLS];
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex
|
||||||
@@ -56,6 +57,7 @@ export default function Navbar() {
|
|||||||
color="gray"
|
color="gray"
|
||||||
className={styles.hamburger}
|
className={styles.hamburger}
|
||||||
onClick={() => setShowHamburgerMenu((state) => !state)}
|
onClick={() => setShowHamburgerMenu((state) => !state)}
|
||||||
|
onBlur={() => setShowHamburgerMenu(false)}
|
||||||
>
|
>
|
||||||
{showHamburgerMenu ? <Cross1Icon /> : <HamburgerMenuIcon />}
|
{showHamburgerMenu ? <Cross1Icon /> : <HamburgerMenuIcon />}
|
||||||
</IconButton>
|
</IconButton>
|
||||||
@@ -256,14 +258,14 @@ export default function Navbar() {
|
|||||||
<ScrollArea>
|
<ScrollArea>
|
||||||
<Flex justify="center">
|
<Flex justify="center">
|
||||||
<Grid
|
<Grid
|
||||||
columns="repeat(auto-fill, minmax(128px, 1fr))"
|
columns="repeat(auto-fill, minmax(192px, 1fr))"
|
||||||
flow="dense"
|
flow="dense"
|
||||||
gap="2"
|
gap="2"
|
||||||
width="100%"
|
width="100%"
|
||||||
p="4"
|
p="3"
|
||||||
pt="0"
|
pt="0"
|
||||||
>
|
>
|
||||||
{TOOLS.map((tool) => (
|
{tools.map((tool) => (
|
||||||
<Flex
|
<Flex
|
||||||
style={{
|
style={{
|
||||||
position: 'relative',
|
position: 'relative',
|
||||||
@@ -272,12 +274,12 @@ export default function Navbar() {
|
|||||||
backgroundImage: `url(${imgur(tool.image, { format: 'jpeg', size: ImgurSize.LargeThumbnail })})`,
|
backgroundImage: `url(${imgur(tool.image, { format: 'jpeg', size: ImgurSize.LargeThumbnail })})`,
|
||||||
backgroundSize: 'cover',
|
backgroundSize: 'cover',
|
||||||
backgroundPosition: 'center',
|
backgroundPosition: 'center',
|
||||||
aspectRatio: '4 / 3',
|
aspectRatio: '2 / 1',
|
||||||
}}
|
}}
|
||||||
onClick={() => setShowHamburgerMenu(false)}
|
onClick={() => setShowHamburgerMenu(false)}
|
||||||
>
|
>
|
||||||
<Link
|
<Link
|
||||||
href={`/tools/${tool.id}`}
|
href={tool.id.length === 0 ? '/' : `/tools/${tool.id}`}
|
||||||
style={{
|
style={{
|
||||||
display: 'flex',
|
display: 'flex',
|
||||||
width: '100%',
|
width: '100%',
|
||||||
|
|||||||
@@ -119,11 +119,18 @@ export const tankPerformanceTool: Tool = {
|
|||||||
image: 'vOKFB03',
|
image: 'vOKFB03',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export const homeTool: Tool = {
|
||||||
|
id: '',
|
||||||
|
title: 'Home',
|
||||||
|
button: { color: 'blue', text: '' },
|
||||||
|
description: '',
|
||||||
|
image: 'rUPie9G',
|
||||||
|
};
|
||||||
|
|
||||||
export const TOOLS: Tool[] = [
|
export const TOOLS: Tool[] = [
|
||||||
tankopediaTool,
|
tankopediaTool,
|
||||||
compareTool,
|
compareTool,
|
||||||
tankPerformanceTool,
|
tankPerformanceTool,
|
||||||
playerStatsTool,
|
|
||||||
sessionTool,
|
sessionTool,
|
||||||
ratingTool,
|
ratingTool,
|
||||||
];
|
];
|
||||||
Reference in new issue
Block a user