mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
feat: some code splitting
This commit is contained in:
1 parent
5f47218f16
commit
6b63231194
5 files changed
+18
-7
No files matched your search
@@ -1,4 +1,4 @@
|
|||||||
import { Flex, Heading, Link } from '@radix-ui/themes';
|
import { Flex, Heading, Link, Text } from '@radix-ui/themes';
|
||||||
import { use } from 'react';
|
import { use } from 'react';
|
||||||
import PageWrapper from '../../../../../components/PageWrapper';
|
import PageWrapper from '../../../../../components/PageWrapper';
|
||||||
import { videoDefinitions } from '../../../../../core/blitzkit/videos';
|
import { videoDefinitions } from '../../../../../core/blitzkit/videos';
|
||||||
@@ -14,7 +14,10 @@ export function Videos() {
|
|||||||
return (
|
return (
|
||||||
<PageWrapper noFlex1>
|
<PageWrapper noFlex1>
|
||||||
<Flex direction="column" gap="4" align="start">
|
<Flex direction="column" gap="4" align="start">
|
||||||
<Heading size="6">Review videos</Heading>
|
<Flex direction="column">
|
||||||
|
<Heading size="6">Review videos</Heading>
|
||||||
|
<Text color="gray">BlitzKit does not endorse any review videos.</Text>
|
||||||
|
</Flex>
|
||||||
|
|
||||||
<Flex gap="3" wrap="wrap">
|
<Flex gap="3" wrap="wrap">
|
||||||
{videos.map((video) => (
|
{videos.map((video) => (
|
||||||
|
|||||||
+1
-1
@@ -5,7 +5,7 @@ import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinit
|
|||||||
|
|
||||||
interface CompactSearchResultRowProps {
|
interface CompactSearchResultRowProps {
|
||||||
tanks: TankDefinition[];
|
tanks: TankDefinition[];
|
||||||
onSelect: (tank: TankDefinition) => void;
|
onSelect?: (tank: TankDefinition) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function CompactSearchResultRow({
|
export function CompactSearchResultRow({
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import { slateDark } from '@radix-ui/colors';
|
import { slateDark } from '@radix-ui/colors';
|
||||||
import { Card, Flex, Inset, Link } from '@radix-ui/themes';
|
import { Card, Flex, Inset, Link, Text } from '@radix-ui/themes';
|
||||||
import { asset } from '../../../../../../core/blitzkit/asset';
|
import { asset } from '../../../../../../core/blitzkit/asset';
|
||||||
import { TankDefinition } from '../../../../../../core/blitzkit/tankDefinitions';
|
import { TankDefinition } from '../../../../../../core/blitzkit/tankDefinitions';
|
||||||
import {
|
import {
|
||||||
@@ -10,14 +10,16 @@ import {
|
|||||||
} from '../../../../../../core/blitzkit/tankDefinitions/constants';
|
} from '../../../../../../core/blitzkit/tankDefinitions/constants';
|
||||||
import { tankIcon } from '../../../../../../core/blitzkit/tankIcon';
|
import { tankIcon } from '../../../../../../core/blitzkit/tankIcon';
|
||||||
import { theme } from '../../../../../../stitches.config';
|
import { theme } from '../../../../../../stitches.config';
|
||||||
|
import * as styles from '../../../page.css';
|
||||||
import { CompactSearchResultRow } from './CompactSearchResultRow';
|
import { CompactSearchResultRow } from './CompactSearchResultRow';
|
||||||
|
|
||||||
interface ResultsProps {
|
interface ResultsProps {
|
||||||
compact?: boolean;
|
compact?: boolean;
|
||||||
results: TankDefinition[];
|
results: TankDefinition[];
|
||||||
|
onSelect?: (tank: TankDefinition) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function Results({ compact, results }: ResultsProps) {
|
export function Results({ compact, results, onSelect }: ResultsProps) {
|
||||||
const firstChunk = compact
|
const firstChunk = compact
|
||||||
? results.slice(0, Math.ceil(results.length / 2))
|
? results.slice(0, Math.ceil(results.length / 2))
|
||||||
: [];
|
: [];
|
||||||
@@ -39,6 +41,7 @@ export function Results({ compact, results }: ResultsProps) {
|
|||||||
{!compact &&
|
{!compact &&
|
||||||
results.map((tank) => (
|
results.map((tank) => (
|
||||||
<Link
|
<Link
|
||||||
|
className={styles.listing}
|
||||||
href={`/tools/tankopedia/${tank.id}`}
|
href={`/tools/tankopedia/${tank.id}`}
|
||||||
style={{
|
style={{
|
||||||
flex: 1,
|
flex: 1,
|
||||||
|
|||||||
@@ -400,7 +400,6 @@ export function TankSearch({
|
|||||||
page * tanksPerPage,
|
page * tanksPerPage,
|
||||||
(page + 1) * tanksPerPage,
|
(page + 1) * tanksPerPage,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
mutateTankopediaPersistent((draft) => {
|
mutateTankopediaPersistent((draft) => {
|
||||||
@@ -853,7 +852,11 @@ export function TankSearch({
|
|||||||
<PageTurner tanksPerPage={tanksPerPage} searchedList={searchResults} />
|
<PageTurner tanksPerPage={tanksPerPage} searchedList={searchResults} />
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<Results compact={compact} results={searchResultsPageSlice} />
|
<Results
|
||||||
|
compact={compact}
|
||||||
|
results={searchResultsPageSlice}
|
||||||
|
onSelect={onSelect}
|
||||||
|
/>
|
||||||
|
|
||||||
{searchResultsPageSlice.length > tanksPerPage / 4 && (
|
{searchResultsPageSlice.length > tanksPerPage / 4 && (
|
||||||
<PageTurner tanksPerPage={tanksPerPage} searchedList={searchResults} />
|
<PageTurner tanksPerPage={tanksPerPage} searchedList={searchResults} />
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import { style } from '@vanilla-extract/css';
|
import { style } from '@vanilla-extract/css';
|
||||||
import { theme } from '../../../stitches.config';
|
import { theme } from '../../../stitches.config';
|
||||||
|
|
||||||
|
export const listing = style({});
|
||||||
|
|
||||||
export const flag = style({
|
export const flag = style({
|
||||||
transitionDuration: theme.durations.regular,
|
transitionDuration: theme.durations.regular,
|
||||||
left: '0',
|
left: '0',
|
||||||
|
|||||||
Reference in new issue
Block a user