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
-1
@@ -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} />
|
||||
|
||||
Reference in new issue
Block a user