mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-24 12:09:51 +02:00
cleanup
This commit is contained in:
1 parent
ba1f530de7
commit
5477616917
8 files changed
+81
-37
No files matched your search
@@ -1,3 +1,7 @@
|
|||||||
.recent {
|
.recent {
|
||||||
/* mt="2" mb="6" */
|
padding: var(--space-4);
|
||||||
|
|
||||||
|
background-color: var(--gray-a2);
|
||||||
|
|
||||||
|
border-radius: var(--space-3);
|
||||||
}
|
}
|
||||||
@@ -6,7 +6,6 @@ import { TankFilters } from "../../stores/tankFilters";
|
|||||||
import { TankopediaPersistent } from "../../stores/tankopediaPersistent";
|
import { TankopediaPersistent } from "../../stores/tankopediaPersistent";
|
||||||
import { TankSort } from "../../stores/tankopediaSort";
|
import { TankSort } from "../../stores/tankopediaSort";
|
||||||
import { Flex } from "../Flex";
|
import { Flex } from "../Flex";
|
||||||
import { Separator } from "../Separator";
|
|
||||||
import { TankCard } from "../TankCard";
|
import { TankCard } from "../TankCard";
|
||||||
import { TankCardWrapper } from "../TankCardWrapper";
|
import { TankCardWrapper } from "../TankCardWrapper";
|
||||||
import { Text } from "../Text";
|
import { Text } from "../Text";
|
||||||
@@ -38,17 +37,16 @@ export function RecentlyViewedTanks() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex column gap="2" className={styles.recent}>
|
<Flex column gap="4" className={styles.recent}>
|
||||||
<Text color="gray" align="center">
|
<Text color="gray" lowContrast>
|
||||||
{strings.website.common.tank_search.recent}
|
{strings.website.common.tank_search.recent}
|
||||||
</Text>
|
</Text>
|
||||||
<TankCardWrapper>
|
|
||||||
|
<TankCardWrapper compact>
|
||||||
{recentlyViewed.map((id) => (
|
{recentlyViewed.map((id) => (
|
||||||
<TankCard tank={tankDefinitions.tanks[id]} key={id} />
|
<TankCard compact tank={tankDefinitions.tanks[id]} key={id} />
|
||||||
))}
|
))}
|
||||||
</TankCardWrapper>
|
</TankCardWrapper>
|
||||||
|
|
||||||
<Separator />
|
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,15 +1,43 @@
|
|||||||
.image-wrapper {
|
.wrapper {
|
||||||
overflow: hidden;
|
--image-height: 6rem;
|
||||||
|
|
||||||
box-sizing: border-box;
|
&[data-compact="true"] {
|
||||||
|
--image-height: 4rem;
|
||||||
|
|
||||||
background-size: auto 100%;
|
.image-wrapper {
|
||||||
background-repeat: no-repeat;
|
background-size: auto 75%;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
height: 6rem;
|
.image-wrapper {
|
||||||
}
|
overflow: hidden;
|
||||||
|
|
||||||
.icon {
|
box-sizing: border-box;
|
||||||
width: 1em;
|
|
||||||
height: 1em;
|
background-size: auto 100%;
|
||||||
|
background-repeat: no-repeat;
|
||||||
|
|
||||||
|
height: var(--image-height);
|
||||||
|
}
|
||||||
|
|
||||||
|
.name {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
|
||||||
|
gap: var(--space-2);
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
width: 1em;
|
||||||
|
height: 1em;
|
||||||
|
min-width: 1em;
|
||||||
|
min-height: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.text {
|
||||||
|
white-space: nowrap;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -11,11 +11,12 @@ import { MAX_RECENTLY_VIEWED } from "../TankSearch/constants";
|
|||||||
import { Text, type TextProps } from "../Text";
|
import { Text, type TextProps } from "../Text";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
type TankCardProps = TextProps & {
|
type TankCardProps = {
|
||||||
tank: TankDefinition;
|
tank: TankDefinition;
|
||||||
onTankSelect?: (tank: TankDefinition) => void;
|
onTankSelect?: (tank: TankDefinition) => void;
|
||||||
discriminator?: ReactNode;
|
discriminator?: ReactNode;
|
||||||
noLink?: boolean;
|
noLink?: boolean;
|
||||||
|
compact?: boolean;
|
||||||
};
|
};
|
||||||
|
|
||||||
const tankDefinitions = await api.tankDefinitions();
|
const tankDefinitions = await api.tankDefinitions();
|
||||||
@@ -25,8 +26,7 @@ export const TankCard = ({
|
|||||||
discriminator,
|
discriminator,
|
||||||
onTankSelect: onSelect,
|
onTankSelect: onSelect,
|
||||||
noLink,
|
noLink,
|
||||||
style,
|
compact,
|
||||||
...props
|
|
||||||
}: TankCardProps) => {
|
}: TankCardProps) => {
|
||||||
const { unwrap, locale } = useLocale();
|
const { unwrap, locale } = useLocale();
|
||||||
|
|
||||||
@@ -45,6 +45,8 @@ export const TankCard = ({
|
|||||||
|
|
||||||
const content = (
|
const content = (
|
||||||
<Flex
|
<Flex
|
||||||
|
className={styles.wrapper}
|
||||||
|
data-compact={compact}
|
||||||
column
|
column
|
||||||
gap="3"
|
gap="3"
|
||||||
onClick={() => {
|
onClick={() => {
|
||||||
@@ -72,11 +74,9 @@ export const TankCard = ({
|
|||||||
/>
|
/>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
|
||||||
<Text color={color} lowContrast={lowContrast}>
|
<Text className={styles.name} color={color} lowContrast={lowContrast}>
|
||||||
<Flex align="center" gap="2" justify="center">
|
<Icon className={styles.icon} />
|
||||||
<Icon className={styles.icon} />
|
<span className={styles.text}>{name}</span>
|
||||||
{name}
|
|
||||||
</Flex>
|
|
||||||
</Text>
|
</Text>
|
||||||
|
|
||||||
{discriminator && (
|
{discriminator && (
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
.wrapper {
|
.wrapper {
|
||||||
|
--min-size: 12rem;
|
||||||
|
|
||||||
display: grid;
|
display: grid;
|
||||||
|
gap: var(--space-5) var(--space-4);
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(var(--min-size), 1fr));
|
||||||
|
|
||||||
gap: var(--space-4);
|
&[data-compact="true"] {
|
||||||
row-gap: var(--space-5);
|
--min-size: 7rem;
|
||||||
|
|
||||||
grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
|
gap: var(--space-4);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -2,9 +2,16 @@ import type { ComponentProps } from "react";
|
|||||||
import { classNames } from "../../ui/classNames";
|
import { classNames } from "../../ui/classNames";
|
||||||
import styles from "./index.module.css";
|
import styles from "./index.module.css";
|
||||||
|
|
||||||
export function TankCardWrapper({
|
interface Props extends ComponentProps<"div"> {
|
||||||
className,
|
compact?: boolean;
|
||||||
...props
|
}
|
||||||
}: ComponentProps<"div">) {
|
|
||||||
return <div className={classNames(styles.wrapper, className)} {...props} />;
|
export function TankCardWrapper({ className, compact, ...props }: Props) {
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={classNames(styles.wrapper, className)}
|
||||||
|
data-compact={compact}
|
||||||
|
{...props}
|
||||||
|
/>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
@@ -1,4 +1,6 @@
|
|||||||
.tanks {
|
.label {
|
||||||
|
margin: var(--space-4) 0;
|
||||||
|
|
||||||
/* mt="2" gap="1" align="center" justify="center" direction="column" */
|
/* mt="2" gap="1" align="center" justify="center" direction="column" */
|
||||||
|
|
||||||
.count {
|
.count {
|
||||||
|
|||||||
@@ -441,7 +441,7 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
|
|
||||||
{!skeleton && !compact && <RecentlyViewedTanks />}
|
{!skeleton && !compact && <RecentlyViewedTanks />}
|
||||||
|
|
||||||
<div className={styles.tanks}>
|
<Flex justify="center" className={styles.label}>
|
||||||
<div className={styles.count}>
|
<div className={styles.count}>
|
||||||
<Text lowContrast>
|
<Text lowContrast>
|
||||||
{sorted.length === 1
|
{sorted.length === 1
|
||||||
@@ -486,7 +486,7 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
, {tankopediaSort.direction}
|
, {tankopediaSort.direction}
|
||||||
</Text>
|
</Text>
|
||||||
)}
|
)}
|
||||||
</div>
|
</Flex>
|
||||||
|
|
||||||
{tankFilters.showTesting && !tankFilters.showNonTesting && (
|
{tankFilters.showTesting && !tankFilters.showNonTesting && (
|
||||||
<div className={styles["test-warning"]}>
|
<div className={styles["test-warning"]}>
|
||||||
|
|||||||
Reference in new issue
Block a user