9148c358d0
Topic_Agent/Topic_Blog/Topics/Topics_Biz/Topics_Meeting/Topics_Rag의 마크다운 지식 문서를 Topic_General/Topic_Programming/Topic_Graphic/Topic_Business 4개 카테고리로 재분류. - 중복 제거: frontmatter의 status:duplicate/merged + duplicate_of/redirect_to 필드로 자기 자신을 중복으로 선언한 리다이렉트 stub 1032개 제거, 완전 동일 내용 파일 472개 제거, 동일 파일명·다른 내용 충돌 시 더 큰(완전한) 버전만 유지(162개 제거) — 총 1639개 중복 제거. - 분류: 폴더 단위로 명확한 항목(AI_and_ML/Coding/Architecture 등 → Programming, Comfyui/Visual_Effects → Graphic, Topics_Biz/Topics_Meeting/사업 등 → Business, Poetic_Blog_Writing/창의성/Game_Design 등 → General)은 폴더 우선순위로, 나머지 혼재 폴더(Topic_Agent/Topic_Blog/Topics 루트/Thinking & Reasoning/Other/UI_UX_Assets)는 title/tags 키워드 스코어링으로 파일 단위 분류(불명확한 경우 General로 폴백). 원본 폴더명은 "From_*" 서브폴더로 보존해 추적 가능성 유지. - 최종 배치: Programming 2784 / General 1608 / Graphic 285 / Business 249 = 4926개 문서. - 에이전트 운영 상태(.astra/.agent/.obsidian/sessions/memory/_company/docs/lessons/_shared/src)는 지식 콘텐츠가 아니므로 재분류 대상에서 제외하고 원위치 유지. - Topics/Topic_email(상위 보호 폴더 Topic_email과 파일명 100% 중복) 삭제 — 보호 폴더 자체는 미변경. - 완전히 비게 된 Topic_Agent/Topic_Blog/Topics_Biz/Topics_Rag 폴더 제거.
6.9 KiB
6.9 KiB
id, title, category, status, canonical_id, aliases, duplicate_of, source_trust_level, confidence_score, verification_status, tags, raw_sources, last_reinforced, github_commit, tech_stack
| id | title | category | status | canonical_id | aliases | duplicate_of | source_trust_level | confidence_score | verification_status | tags | raw_sources | last_reinforced | github_commit | tech_stack | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| wiki-2026-0508-모듈식-컴포넌트-modular-components | 모듈식 컴포넌트 (Modular Components) | 10_Wiki/Topics | verified | self |
|
none | A | 0.9 | applied |
|
2026-05-10 | pending |
|
모듈식 컴포넌트 (Modular Components)
매 한 줄
"매 single-responsibility의 재사용 가능한 unit을 composable interface로 묶어 system을 build". 2003 Brad Frost의 Atomic Design → 2013 React 도입 → 2020 design-token 기반 Headless UI (Radix, shadcn) → 2026 현재 Server Components + Web Components의 hybrid composition이 mainstream.
매 핵심
매 5 Properties of Modular Component
- Single Responsibility: 매 component 하나의 명확한 purpose.
- Encapsulation: 매 internal state / DOM 외부 격리.
- Composability: 매 children / slots 통한 nested 조합 가능.
- Configurability via props: 매 behavior 외부 inject (no hard-coded).
- Testability in isolation: 매 mock 없이 unit-test 가능.
매 Composition Patterns
- Compound Components: 매
<Tabs><Tabs.List/><Tabs.Panel/></Tabs>— context-shared. - Slots / Render Props: 매 children 위치 customization.
- Polymorphic
asprop: 매<Button as="a" href=...>— element type swap. - Headless / Bring-Your-Own-Style: 매 logic만 제공, style은 consumer 결정 (Radix).
매 응용
- Atomic Design (Atoms → Molecules → Organisms → Templates).
- Material UI / Chakra / shadcn-ui — design-system implementations.
- Storybook — component-driven dev / docs.
- Web Components (LitElement) — framework-agnostic, browser-native.
💻 패턴
Compound Component (React)
import { createContext, useContext, useState, ReactNode } from 'react';
const TabsCtx = createContext<{active: string; setActive: (v: string) => void} | null>(null);
export function Tabs({ defaultValue, children }: { defaultValue: string; children: ReactNode }) {
const [active, setActive] = useState(defaultValue);
return <TabsCtx.Provider value={{active, setActive}}>{children}</TabsCtx.Provider>;
}
Tabs.List = ({ children }: { children: ReactNode }) => <div role="tablist">{children}</div>;
Tabs.Trigger = ({ value, children }: { value: string; children: ReactNode }) => {
const ctx = useContext(TabsCtx)!;
return (
<button role="tab" aria-selected={ctx.active === value} onClick={() => ctx.setActive(value)}>
{children}
</button>
);
};
Tabs.Panel = ({ value, children }: { value: string; children: ReactNode }) => {
const ctx = useContext(TabsCtx)!;
return ctx.active === value ? <div role="tabpanel">{children}</div> : null;
};
Polymorphic Component
type AsProp<C extends React.ElementType> = { as?: C };
type PolymorphicProps<C extends React.ElementType, P = {}> =
P & AsProp<C> & Omit<React.ComponentPropsWithoutRef<C>, keyof (P & AsProp<C>)>;
export function Box<C extends React.ElementType = 'div'>(
{ as, children, ...rest }: PolymorphicProps<C, { variant?: 'card' | 'inline' }>
) {
const Tag = as || 'div';
return <Tag {...rest}>{children}</Tag>;
}
// usage: <Box as="a" href="/x">link</Box>
Headless Hook (Disclosure)
import { useState, useId, useCallback } from 'react';
export function useDisclosure(initial = false) {
const [open, setOpen] = useState(initial);
const id = useId();
return {
isOpen: open,
toggle: useCallback(() => setOpen(o => !o), []),
open: useCallback(() => setOpen(true), []),
close: useCallback(() => setOpen(false), []),
triggerProps: { 'aria-expanded': open, 'aria-controls': id },
panelProps: { id, hidden: !open },
};
}
Web Component (Lit)
import { LitElement, html, css } from 'lit';
import { customElement, property } from 'lit/decorators.js';
@customElement('ag-button')
export class AgButton extends LitElement {
static styles = css`
button { padding: 0.5rem 1rem; border-radius: 0.375rem; }
:host([variant="primary"]) button { background: var(--ag-primary, #2563eb); color: white; }
`;
@property() variant: 'primary' | 'ghost' = 'primary';
render() {
return html`<button @click=${() => this.dispatchEvent(new CustomEvent('ag-click'))}>
<slot></slot>
</button>`;
}
}
Design Token (CSS variables)
:root {
--color-primary-50: #eff6ff;
--color-primary-500: #3b82f6;
--color-primary-900: #1e3a8a;
--space-1: 0.25rem;
--space-2: 0.5rem;
--radius-md: 0.375rem;
--shadow-sm: 0 1px 2px rgb(0 0 0 / 0.05);
}
.btn {
padding: var(--space-2) var(--space-2);
background: var(--color-primary-500);
border-radius: var(--radius-md);
box-shadow: var(--shadow-sm);
}
React Server Component composition
// app/dashboard/page.tsx — Server Component
import { Suspense } from 'react';
import { ChartCard } from '@/components/ChartCard';
import { ClientFilters } from './filters.client';
export default async function Page() {
const data = await fetchDashboardData(); // server-only
return (
<main>
<ClientFilters />
<Suspense fallback={<Skeleton />}>
<ChartCard data={data.revenue} />
</Suspense>
</main>
);
}
매 결정 기준
| 상황 | Approach |
|---|---|
| 단일 React app | Compound + headless hooks |
| Cross-framework / micro-frontend | Web Components |
| Design system 배포 | Headless (Radix-style) + design tokens |
| SSR-heavy | RSC + selective Client Components |
| Mobile (RN) | Headless logic + platform-specific render |
기본값: Compound components + design tokens + Storybook isolation.
🔗 Graph
- 부모: Design_System
- 변형: Headless_UI · Compound_Components
- 응용: Storybook · Radix_UI · shadcn · Lit
- Adjacent: Atomic_Design · Design_Tokens · React_Server_Components
🤖 LLM 활용
언제: scaffold component variants, prop-type derivation, story / test generation, a11y attribute fill-in. 언제 X: 매 design decisions (token system shape, theming model) — 매 human design-system curator 영역.
❌ 안티패턴
- God component: 매 1000-line component, 다목적 props 30개.
- Prop drilling 5+ levels: 매 context / composition으로 refactor.
- Style leakage: 매 :global / inherited styles → encapsulation 깨짐.
- Tight coupling to data fetch: 매 component 내부에서 직접 fetch → reuse 불가능.
🧪 검증 / 중복
- Verified (Brad Frost Atomic Design, React docs, Radix UI specs).
- 신뢰도 A.
🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — modular component 5-property + composition patterns + RSC 정리 |