feat: 클리닉 전용 페이지 추가, PageContainer 도입, 불필요한 ui 주석처리
This commit is contained in:
1 parent
e66b208318
commit
49367756ea
77 files changed
+3498
-924
No files matched your search
@@ -0,0 +1,160 @@
|
||||
/**
|
||||
* ChannelLinkButtons — 등록된 플랫폼 URL/핸들로 새 탭 열기 버튼 묶음.
|
||||
*
|
||||
* Report / Plan 헤더 영역에서 공통 사용.
|
||||
* - 입력은 normalized handle(@view_clinic) 또는 URL(view.co.kr) 모두 허용
|
||||
* - 비어있는 플랫폼은 자동 생략
|
||||
* - 디자인: white/60 backdrop-blur + 호버 시 더 진해짐 (ReportHeader 의 메타 칩과 동일 톤)
|
||||
*/
|
||||
import { ExternalLink, Heart, MapPin } from 'lucide-react';
|
||||
import type { CSSProperties } from 'react';
|
||||
import {
|
||||
InstagramFilled,
|
||||
YoutubeFilled,
|
||||
FacebookFilled,
|
||||
GlobeFilled,
|
||||
TiktokFilled,
|
||||
FileTextFilled,
|
||||
} from '@/shared/icons/FilledIcons';
|
||||
|
||||
export interface ChannelHandles {
|
||||
website?: string | null;
|
||||
instagram?: string | null;
|
||||
youtube?: string | null;
|
||||
facebook?: string | null;
|
||||
tiktok?: string | null;
|
||||
gangnamUnni?: string | null;
|
||||
naverPlace?: string | null;
|
||||
naverBlog?: string | null;
|
||||
}
|
||||
|
||||
type PlatformKey = keyof ChannelHandles;
|
||||
|
||||
interface PlatformMeta {
|
||||
label: string;
|
||||
color: string;
|
||||
Icon: (props: { size?: number; className?: string; style?: CSSProperties }) => React.ReactElement;
|
||||
buildUrl: (handle: string) => string;
|
||||
}
|
||||
|
||||
const META: Record<PlatformKey, PlatformMeta> = {
|
||||
website: {
|
||||
label: '홈페이지',
|
||||
color: '#6C5CE7',
|
||||
Icon: GlobeFilled,
|
||||
buildUrl: (h) => (/^https?:\/\//.test(h) ? h : `https://${h}`),
|
||||
},
|
||||
instagram: {
|
||||
label: 'Instagram',
|
||||
color: '#833AB4',
|
||||
Icon: InstagramFilled,
|
||||
buildUrl: (h) => `https://instagram.com/${h.replace(/^@/, '')}`,
|
||||
},
|
||||
youtube: {
|
||||
label: 'YouTube',
|
||||
color: '#FF3D3D',
|
||||
Icon: YoutubeFilled,
|
||||
buildUrl: (h) => `https://youtube.com/${h.startsWith('@') ? h : `@${h}`}`,
|
||||
},
|
||||
facebook: {
|
||||
label: 'Facebook',
|
||||
color: '#1877F2',
|
||||
Icon: FacebookFilled,
|
||||
buildUrl: (h) => (/^https?:\/\//.test(h) ? h : `https://facebook.com/${h}`),
|
||||
},
|
||||
tiktok: {
|
||||
label: 'TikTok',
|
||||
color: '#0A1128',
|
||||
Icon: TiktokFilled,
|
||||
buildUrl: (h) => `https://tiktok.com/${h.startsWith('@') ? h : `@${h}`}`,
|
||||
},
|
||||
gangnamUnni: {
|
||||
label: '강남언니',
|
||||
color: '#FF6B8A',
|
||||
Icon: Heart,
|
||||
buildUrl: (h) => {
|
||||
if (/^https?:\/\//.test(h)) return h;
|
||||
if (/gangnamunni\.com\//.test(h)) return `https://www.${h.replace(/^\/+/, '')}`;
|
||||
return `https://www.gangnamunni.com/hospitals/${h.replace(/^\//, '')}`;
|
||||
},
|
||||
},
|
||||
naverPlace: {
|
||||
label: '네이버 플레이스',
|
||||
color: '#03C75A',
|
||||
Icon: MapPin,
|
||||
buildUrl: (h) => {
|
||||
if (/^https?:\/\//.test(h)) return h;
|
||||
if (/place\.naver\.com\//.test(h)) return `https://m.${h.replace(/^m\./, '').replace(/^\/+/, '')}/home`;
|
||||
return `https://m.place.naver.com/hospital/${h.replace(/^\//, '')}/home`;
|
||||
},
|
||||
},
|
||||
naverBlog: {
|
||||
label: '네이버 블로그',
|
||||
color: '#03C75A',
|
||||
Icon: FileTextFilled,
|
||||
buildUrl: (h) => {
|
||||
if (/^https?:\/\//.test(h)) return h;
|
||||
if (/blog\.naver\.com\//.test(h)) return `https://${h.replace(/^\/+/, '')}`;
|
||||
return `https://blog.naver.com/${h.replace(/^\//, '')}`;
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
const ORDER: PlatformKey[] = [
|
||||
'website',
|
||||
'youtube',
|
||||
'instagram',
|
||||
'facebook',
|
||||
'naverPlace',
|
||||
'naverBlog',
|
||||
'gangnamUnni',
|
||||
'tiktok',
|
||||
];
|
||||
|
||||
interface ChannelLinkButtonsProps {
|
||||
handles: ChannelHandles;
|
||||
variant?: 'light' | 'solid';
|
||||
className?: string;
|
||||
}
|
||||
|
||||
export function ChannelLinkButtons({
|
||||
handles,
|
||||
variant = 'light',
|
||||
className,
|
||||
}: ChannelLinkButtonsProps) {
|
||||
const entries = ORDER.flatMap((key) => {
|
||||
const handle = handles[key];
|
||||
if (!handle) return [];
|
||||
return [{ key, handle }];
|
||||
});
|
||||
if (entries.length === 0) return null;
|
||||
|
||||
const baseClass =
|
||||
variant === 'light'
|
||||
? 'bg-white/60 backdrop-blur-sm border border-white/40 hover:bg-white/80 text-slate-700'
|
||||
: 'bg-white border border-slate-200 hover:border-slate-300 hover:bg-slate-50 text-slate-700';
|
||||
|
||||
return (
|
||||
<div className={`flex flex-wrap gap-2 ${className ?? ''}`}>
|
||||
{entries.map(({ key, handle }) => {
|
||||
const meta = META[key];
|
||||
const Icon = meta.Icon;
|
||||
const url = meta.buildUrl(handle);
|
||||
return (
|
||||
<a
|
||||
key={key}
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
className={`inline-flex items-center gap-2 rounded-full px-3.5 py-2 text-xs font-medium transition-colors ${baseClass}`}
|
||||
title={`${meta.label} — ${url}`}
|
||||
>
|
||||
<Icon size={16} className="shrink-0" style={{ color: meta.color }} />
|
||||
<span className="truncate max-w-[140px]">{handle}</span>
|
||||
<ExternalLink size={12} className="text-slate-400" />
|
||||
</a>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
/**
|
||||
* shadcn DropdownMenu — radix-ui 의 DropdownMenu primitive 위에 얇은 스타일 wrapper.
|
||||
* 필요한 part만 export: Root / Trigger / Content / Item / Separator.
|
||||
*/
|
||||
import * as React from "react"
|
||||
import { DropdownMenu as DropdownMenuPrimitive } from "radix-ui"
|
||||
|
||||
import { cn } from "@/shared/lib/utils"
|
||||
|
||||
function DropdownMenu(props: React.ComponentProps<typeof DropdownMenuPrimitive.Root>) {
|
||||
return <DropdownMenuPrimitive.Root data-slot="dropdown-menu" {...props} />
|
||||
}
|
||||
|
||||
function DropdownMenuTrigger(props: React.ComponentProps<typeof DropdownMenuPrimitive.Trigger>) {
|
||||
return <DropdownMenuPrimitive.Trigger data-slot="dropdown-menu-trigger" {...props} />
|
||||
}
|
||||
|
||||
function DropdownMenuContent({
|
||||
className,
|
||||
sideOffset = 6,
|
||||
align = "end",
|
||||
...props
|
||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.Content>) {
|
||||
return (
|
||||
<DropdownMenuPrimitive.Portal>
|
||||
<DropdownMenuPrimitive.Content
|
||||
data-slot="dropdown-menu-content"
|
||||
sideOffset={sideOffset}
|
||||
align={align}
|
||||
className={cn(
|
||||
"z-50 min-w-[10rem] overflow-hidden rounded-xl border border-slate-200 bg-white p-1 text-slate-700 shadow-lg",
|
||||
"data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
</DropdownMenuPrimitive.Portal>
|
||||
)
|
||||
}
|
||||
|
||||
function DropdownMenuItem({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.Item>) {
|
||||
return (
|
||||
<DropdownMenuPrimitive.Item
|
||||
data-slot="dropdown-menu-item"
|
||||
className={cn(
|
||||
"relative flex cursor-pointer select-none items-center gap-2 rounded-lg px-3 py-2 text-sm outline-none transition-colors hover:bg-slate-100 focus:bg-slate-100 data-[disabled]:pointer-events-none data-[disabled]:opacity-50",
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
function DropdownMenuSeparator({
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<typeof DropdownMenuPrimitive.Separator>) {
|
||||
return (
|
||||
<DropdownMenuPrimitive.Separator
|
||||
data-slot="dropdown-menu-separator"
|
||||
className={cn("-mx-1 my-1 h-px bg-slate-100", className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export {
|
||||
DropdownMenu,
|
||||
DropdownMenuTrigger,
|
||||
DropdownMenuContent,
|
||||
DropdownMenuItem,
|
||||
DropdownMenuSeparator,
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
/**
|
||||
* EmptyState — 리포트/플랜의 섹션·서브섹션에서 데이터가 없을 때 공통으로 쓰는 fallback.
|
||||
*
|
||||
* size:
|
||||
* - sm: 카드 안 작은 영역 (서브섹션, 그래프 자리 등)
|
||||
* - md: 섹션 내부 일반 영역 (기본값)
|
||||
* - lg: SectionWrapper 전체를 채우는 경우
|
||||
*
|
||||
* 사용 예:
|
||||
* {nonEmpty(items) ? <List items={items} /> : <EmptyState size="sm" />}
|
||||
*/
|
||||
import { cn } from '@/shared/lib/utils';
|
||||
|
||||
interface EmptyStateProps {
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
hint?: string;
|
||||
className?: string;
|
||||
}
|
||||
|
||||
const sizeMap = {
|
||||
sm: 'px-4 py-5 rounded-xl',
|
||||
md: 'px-6 py-8 rounded-2xl',
|
||||
lg: 'px-6 py-12 rounded-2xl',
|
||||
} as const;
|
||||
|
||||
const textSizeMap = {
|
||||
sm: 'text-xs',
|
||||
md: 'text-sm',
|
||||
lg: 'text-sm',
|
||||
} as const;
|
||||
|
||||
export function EmptyState({ size = 'md', hint, className }: EmptyStateProps) {
|
||||
return (
|
||||
<div
|
||||
className={cn(
|
||||
'border border-dashed border-slate-200 bg-slate-50/50 text-center',
|
||||
sizeMap[size],
|
||||
className,
|
||||
)}
|
||||
>
|
||||
<p className={cn('text-slate-500', textSizeMap[size])}>데이터 없음</p>
|
||||
{hint && <p className="text-xs text-slate-400 mt-1">{hint}</p>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
import * as React from 'react'
|
||||
import { Slot } from 'radix-ui'
|
||||
|
||||
import { cn } from '@/shared/lib/utils'
|
||||
|
||||
function PageContainer({
|
||||
asChild = false,
|
||||
className,
|
||||
...props
|
||||
}: React.ComponentProps<'div'> & { asChild?: boolean }) {
|
||||
const Comp = asChild ? Slot.Root : 'div'
|
||||
return (
|
||||
<Comp
|
||||
data-slot="page-container"
|
||||
className={cn('mx-auto w-full max-w-7xl px-6', className)}
|
||||
{...props}
|
||||
/>
|
||||
)
|
||||
}
|
||||
|
||||
export { PageContainer }
|
||||
Reference in new issue
Block a user