feat: some code splitting

This commit is contained in:
TrèsAbhi committed 2024-05-22 13:43:08 -05:00
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 PageWrapper from '../../../../../components/PageWrapper';
import { videoDefinitions } from '../../../../../core/blitzkit/videos';
@@ -14,7 +14,10 @@ export function Videos() {
return (
<PageWrapper noFlex1>
<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">
{videos.map((video) => (
@@ -5,7 +5,7 @@ import { TIER_ROMAN_NUMERALS } from '../../../../../../core/blitzkit/tankDefinit
interface CompactSearchResultRowProps {
tanks: TankDefinition[];
onSelect: (tank: TankDefinition) => void;
onSelect?: (tank: TankDefinition) => void;
}
export function CompactSearchResultRow({
@@ -1,5 +1,5 @@
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 { TankDefinition } from '../../../../../../core/blitzkit/tankDefinitions';
import {
@@ -10,14 +10,16 @@ import {
} from '../../../../../../core/blitzkit/tankDefinitions/constants';
import { tankIcon } from '../../../../../../core/blitzkit/tankIcon';
import { theme } from '../../../../../../stitches.config';
import * as styles from '../../../page.css';
import { CompactSearchResultRow } from './CompactSearchResultRow';
interface ResultsProps {
compact?: boolean;
results: TankDefinition[];
onSelect?: (tank: TankDefinition) => void;
}
export function Results({ compact, results }: ResultsProps) {
export function Results({ compact, results, onSelect }: ResultsProps) {
const firstChunk = compact
? results.slice(0, Math.ceil(results.length / 2))
: [];
@@ -39,6 +41,7 @@ export function Results({ compact, results }: ResultsProps) {
{!compact &&
results.map((tank) => (
<Link
className={styles.listing}
href={`/tools/tankopedia/${tank.id}`}
style={{
flex: 1,
@@ -400,7 +400,6 @@ export function TankSearch({
page * tanksPerPage,
(page + 1) * tanksPerPage,
);
useEffect(() => {
mutateTankopediaPersistent((draft) => {
@@ -853,7 +852,11 @@ export function TankSearch({
<PageTurner tanksPerPage={tanksPerPage} searchedList={searchResults} />
)}
<Results compact={compact} results={searchResultsPageSlice} />
<Results
compact={compact}
results={searchResultsPageSlice}
onSelect={onSelect}
/>
{searchResultsPageSlice.length > tanksPerPage / 4 && (
<PageTurner tanksPerPage={tanksPerPage} searchedList={searchResults} />
+2
View File
@@ -1,6 +1,8 @@
import { style } from '@vanilla-extract/css';
import { theme } from '../../../stitches.config';
export const listing = style({});
export const flag = style({
transitionDuration: theme.durations.regular,
left: '0',