Commit cdb54980 authored by timel's avatar timel

fix: small

parent 3a9b2d64
Pipeline #23141 passed with stages
in 13 minutes and 47 seconds
...@@ -145,6 +145,11 @@ export function isLinkMonster(typeCode: number): boolean { ...@@ -145,6 +145,11 @@ export function isLinkMonster(typeCode: number): boolean {
return (typeCode & TYPE_LINK) > 0; return (typeCode & TYPE_LINK) > 0;
} }
/** 判断是灵摆怪兽 */
export function isPendulumMonster(typeCode: number): boolean {
return (typeCode & TYPE_PENDULUM) > 0;
}
// 属性 // 属性
// const ATTRIBUTE_ALL = 0x7f; // // const ATTRIBUTE_ALL = 0x7f; //
const ATTRIBUTE_EARTH = 0x01; // const ATTRIBUTE_EARTH = 0x01; //
......
@charset "utf-8"; @charset "utf-8";
@import url("https://fonts.font.im/css2?family=Electrolize&display=swap"); @import url("https://fonts.font.im/css2?family=Electrolize&family=Noto+Serif+SC:wght@700&display=swap");
body { body {
color-scheme: dark; color-scheme: dark;
...@@ -16,6 +16,7 @@ body { ...@@ -16,6 +16,7 @@ body {
right: 0; right: 0;
font-family: var(--theme-font); font-family: var(--theme-font);
--theme-font: "Electrolize", sans-serif; --theme-font: "Electrolize", sans-serif;
--nato-serif-font: "Noto Serif SC", serif;
--header-height: 56px; --header-height: 56px;
#root { #root {
height: 100%; height: 100%;
......
...@@ -17,14 +17,21 @@ ...@@ -17,14 +17,21 @@
.container { .container {
height: 100%; height: 100%;
background-color: hsla(0, 0%, 100%, 0.1); background: linear-gradient(
box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2), 0 0 30px 0 #ffffff54; to bottom right,
hsla(0, 0%, 100%, 0.2),
hsla(0, 0%, 100%, 0)
);
box-shadow:
-1px 0 0 2px rgba(255, 255, 255, 0.15),
0 0 30px 0 #ffffff54;
backdrop-filter: blur(20px); backdrop-filter: blur(20px);
@include utils.noise-bg; @include utils.noise-bg;
padding: 15px; padding: 15px;
display: flex; display: flex;
flex-direction: column; flex-direction: column;
position: relative; position: relative;
border-radius: 8px;
} }
.btn-close { .btn-close {
...@@ -40,17 +47,23 @@ ...@@ -40,17 +47,23 @@
flex-shrink: 0; flex-shrink: 0;
border-radius: 4px; border-radius: 4px;
overflow: hidden; overflow: hidden;
box-shadow: 0px 14px 20px -5px rgba(0, 0, 0, 0.3); box-shadow:
transition: 0.2s; 0 0px 0px -15px #5a627a,
0 0px 5px -30px #41485f;
transition: 0.3s;
cursor: pointer;
&:hover { &:hover {
--width: 220px; --width: 200px;
box-shadow: 0px 20px 20px -5px rgb(0 0 0 / 60%); filter: contrast(1.1);
box-shadow:
25px 0px 2px -15px #5a627a,
50px 0px 5px -30px #41485f;
} }
} }
.title { .title {
font-size: 16px; font-size: 20px;
font-family: var(--theme-font); font-family: var(--nato-serif-font);
margin: 20px 0 15px; margin: 20px 0 15px;
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
...@@ -58,6 +71,5 @@ ...@@ -58,6 +71,5 @@
} }
.content { .content {
// font-size: ;
color: white; color: white;
} }
...@@ -10,6 +10,7 @@ import { ...@@ -10,6 +10,7 @@ import {
isMonster, isMonster,
Race2StringCodeMap, Race2StringCodeMap,
Type2StringCodeMap, Type2StringCodeMap,
isPendulumMonster,
} from "@/common"; } from "@/common";
import { CardEffectText, IconFont, ScrollableArea, YgoCard } from "@/ui/Shared"; import { CardEffectText, IconFont, ScrollableArea, YgoCard } from "@/ui/Shared";
...@@ -31,6 +32,14 @@ export const CardDetail: React.FC<{ ...@@ -31,6 +32,14 @@ export const CardDetail: React.FC<{
.join(" / "), .join(" / "),
[card?.data.type], [card?.data.type],
); );
const desc = useMemo(
() =>
isPendulumMonster(card?.data.type ?? 0)
? processPendulumString(card?.text.desc ?? "")
: [card?.text.desc],
[card?.text.desc],
);
return ( return (
<div className={classNames(styles.detail, { [styles.open]: open })}> <div className={classNames(styles.detail, { [styles.open]: open })}>
<div className={styles.container}> <div className={styles.container}>
...@@ -40,7 +49,9 @@ export const CardDetail: React.FC<{ ...@@ -40,7 +49,9 @@ export const CardDetail: React.FC<{
type="text" type="text"
onClick={onClose} onClick={onClose}
/> />
<YgoCard className={styles.card} code={code} /> <a href={`https://ygocdb.com/card/${code}`} target="_blank">
<YgoCard className={styles.card} code={code} />
</a>
<div className={styles.title}> <div className={styles.title}>
<span>{card?.text.name}</span> <span>{card?.text.name}</span>
{/* <Avatar size={22}>光</Avatar> */} {/* <Avatar size={22}>光</Avatar> */}
...@@ -87,12 +98,31 @@ export const CardDetail: React.FC<{ ...@@ -87,12 +98,31 @@ export const CardDetail: React.FC<{
)} )}
</Descriptions> </Descriptions>
<Descriptions layout="vertical" size="small"> <Descriptions layout="vertical" size="small">
<Descriptions.Item label="卡片效果" span={3}> {desc.filter(Boolean).map((d, i) => (
<CardEffectText desc={card?.text.desc} /> <Descriptions.Item
</Descriptions.Item> label={
desc.length > 1 ? (i ? "怪兽效果" : "灵摆效果") : "卡片效果"
}
span={3}
key={i}
>
<CardEffectText desc={d} />
</Descriptions.Item>
))}
</Descriptions> </Descriptions>
</ScrollableArea> </ScrollableArea>
</div> </div>
</div> </div>
); );
}; };
function processPendulumString(input: string): string[] {
// 删除形如“← ... →”的结构
const withoutArrows = input.replace(/←.*?→/g, "");
// 以 "【怪兽效果】" 作为分隔符切割字符串
const splitStrings = withoutArrows.split("【怪兽效果】");
// 返回切割后的字符串列表
return splitStrings.map((s) => s.trim());
}
...@@ -105,6 +105,10 @@ ...@@ -105,6 +105,10 @@
position: relative; position: relative;
background-size: contain; background-size: contain;
content-visibility: auto; content-visibility: auto;
transition: 0.1s;
&:hover {
filter: brightness(0.9);
}
.cardname { .cardname {
font-size: 12px; font-size: 12px;
position: absolute; position: absolute;
...@@ -123,7 +127,6 @@ ...@@ -123,7 +127,6 @@
} }
.cardcover { .cardcover {
position: relative; position: relative;
// z-index: 1;
} }
} }
......
...@@ -3,10 +3,10 @@ ...@@ -3,10 +3,10 @@
font-size: 14px; font-size: 14px;
max-height: calc(100% - 237px); max-height: calc(100% - 237px);
font-family: var(--theme-font); font-family: var(--theme-font);
white-space: pre-wrap;
.maro-item { .maro-item {
display: flex; display: flex;
margin-top: 8px; gap: 8px;
gap: 6px;
} }
} }
...@@ -72,5 +72,3 @@ function addSpaces(str: string): string { ...@@ -72,5 +72,3 @@ function addSpaces(str: string): string {
const regex = /\d+/g; const regex = /\d+/g;
return str.replace(regex, (match) => ` ${match} `); return str.replace(regex, (match) => ` ${match} `);
} }
// function removePendulumPrefix(str: string): string {}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment