섯다: 화투 월 숫자를 왼쪽 아래에 크게(흰 글씨 + 검은 테두리) 표시, 겹친 상대 카드에서도 보이게
HwatuCard에 monthStyle='corner' 추가(기본 'badge'는 고스톱 등 그대로). 상대 자리 카드는 다음 카드가 오른쪽 30%를 덮어 오른쪽 위 배지가 가려졌는데, 왼쪽 아래 숫자는 겹쳐도 보인다. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
/**
|
||||
* Hwatu card: the real 48-card hwatu artwork from Wikimedia Commons "SVG Hwatu" (Marcus Richert after Louie Mantia Jr.,
|
||||
* CC BY-SA 4.0 — ./hwatu/ATTRIBUTION.txt, docs/games/seotda.md "화투 그림"), bundled from our own origin (no external
|
||||
* URLs). A small month badge stays on top so beginners can read the card at a glance;
|
||||
* URLs). A small month badge stays on top so beginners can read the card at a glance (섯다 instead draws a big outlined
|
||||
* number in the bottom-left corner, which stays visible when cards overlap);
|
||||
* 쌍피 / bonus cards get their value tag (고스톱). The back and the bonus cards are drawn here.
|
||||
*/
|
||||
import type { CSSProperties } from 'react';
|
||||
@@ -70,6 +71,15 @@ function BonusFace({ w, h, value }: { w: number; h: number; value: number }) {
|
||||
);
|
||||
}
|
||||
|
||||
/** Dark outline around white text (8 directions + soft shadow), readable on both the white and black parts of a card. */
|
||||
const cornerOutline = (t: number): string =>
|
||||
[
|
||||
[-t, -t], [0, -t], [t, -t], [-t, 0], [t, 0], [-t, t], [0, t], [t, t],
|
||||
]
|
||||
.map(([x, y]) => `${x}px ${y}px 0 #111827`)
|
||||
.concat('0 1px 3px rgba(0,0,0,0.6)')
|
||||
.join(', ');
|
||||
|
||||
export function HwatuCard({
|
||||
card,
|
||||
size = 'md',
|
||||
@@ -78,6 +88,7 @@ export function HwatuCard({
|
||||
dimmed,
|
||||
highlight,
|
||||
showMonth = true,
|
||||
monthStyle = 'badge',
|
||||
onClick,
|
||||
className,
|
||||
style,
|
||||
@@ -91,6 +102,8 @@ export function HwatuCard({
|
||||
highlight?: boolean;
|
||||
/** Small month number badge (on by default). */
|
||||
showMonth?: boolean;
|
||||
/** 'badge': small dark circle top-right. 'corner': big white outlined number bottom-left (섯다). */
|
||||
monthStyle?: 'badge' | 'corner';
|
||||
onClick?: () => void;
|
||||
className?: string;
|
||||
style?: CSSProperties;
|
||||
@@ -142,7 +155,27 @@ export function HwatuCard({
|
||||
) : (
|
||||
<img src={hwatuSrc(card.id)} alt="" draggable={false} width={w} height={h} decoding="async" style={{ display: 'block', width: w, height: h, borderRadius: radius }} />
|
||||
)}
|
||||
{showMonth && card.month > 0 && (
|
||||
{showMonth && card.month > 0 && monthStyle === 'corner' && (
|
||||
<span
|
||||
aria-hidden
|
||||
style={{
|
||||
position: 'absolute',
|
||||
left: Math.round(w * 0.08),
|
||||
bottom: Math.round(w * 0.06),
|
||||
color: '#fff',
|
||||
fontSize: Math.max(12, Math.round(8 + w * 0.26)),
|
||||
fontWeight: 900,
|
||||
lineHeight: 1,
|
||||
letterSpacing: '-0.04em',
|
||||
textShadow: cornerOutline(Math.max(1, Math.round(w * 0.025))),
|
||||
fontFamily: 'Pretendard Variable, sans-serif',
|
||||
pointerEvents: 'none',
|
||||
}}
|
||||
>
|
||||
{card.month}
|
||||
</span>
|
||||
)}
|
||||
{showMonth && card.month > 0 && monthStyle === 'badge' && (
|
||||
<span
|
||||
aria-hidden
|
||||
style={{
|
||||
|
||||
Reference in New Issue
Block a user