[G1-Sync] Manual knowledge update

This commit is contained in:
Antigravity Agent
2026-05-10 22:08:15 +09:00
parent 21ac3ed255
commit 504fd5fb42
3011 changed files with 380280 additions and 206977 deletions
+229 -66
View File
@@ -2,92 +2,255 @@
id: wiki-2026-0508-shopify-polaris
title: Shopify Polaris
category: 10_Wiki/Topics
status: needs_review
status: verified
canonical_id: self
aliases: []
aliases: [Polaris, Shopify Design System, Polaris React]
duplicate_of: none
source_trust_level: A
confidence_score: 0.92
tags: [uncategorized]
confidence_score: 0.9
verification_status: applied
tags: [design-system, shopify, polaris, react, admin-ui]
raw_sources: []
last_reinforced: 2026-05-08
last_reinforced: 2026-05-10
github_commit: pending
inferred_by: Claude Opus 4.7 (auto-normalize 2026-05-08)
tech_stack:
language: unspecified
framework: unspecified
language: TypeScript
framework: React + @shopify/polaris
---
# [[Shopify Polaris|Shopify Polaris]]
# Shopify Polaris
## 📌 한 줄 통찰 (The Karpathy Summary)
Shopify Polaris는 Shopify 앱을 위해 일관되고 사용자 친화적이며 접근성 높은 인터페이스를 구축할 수 있도록 돕는 공식 오픈소스 디자인 시스템입니다 [1-3]. 이 시스템은 개발자와 디자이너를 위한 가이드라인, 원칙, 그리고 사전 빌드된 다양한 React UI 컴포넌트들을 제공합니다 [1, 3, 4]. 이를 통해 개발자는 고유의 기능을 개발하는 데 집중하면서도 Shopify 생태계에 자연스럽게 녹아드는 확장 가능한 UI를 빠르게 구현할 수 있습니다 [3, 5, 6].
## 한 줄
> **"매 Polaris 는 Shopify 의 admin/merchant facing design system"**. React component lib + design guidelines + token (SCSS/CSS vars) 패키지. App Bridge 와 함께 매 Shopify embedded app 의 standard UI. 2026 기준 v13 — modular import + CSS vars + dark mode 지원, App Bridge React 4.x 와 통합.
## 📖 구조화된 지식 (Synthesized Content)
* **구성과 원칙:** Polaris 문서는 Foundations, Content, Design, Components, Experience의 5개 섹션으로 나뉘어 있으며, 컴포넌트 자체뿐만 아니라 UI/UX 설계 모범 사례(Best practices)와 콘텐츠 가이드라인을 함께 제공합니다 [7, 8]. "고려하는(Considerate)", "정교한(Crafted)", "친숙한(Familiar)" 등의 핵심 경험 가치를 강조하며, 다국어 지원(i18n) 및 현지화 통화 포맷 등 글로벌 사용성을 보장합니다 [9, 10].
* **React 컴포넌트 아키텍처:** Polaris는 React 기반으로 구축되어 있으며, Modal, Navigation, Stack, Card, Form 등 애플리케이션 개발에 필수적인 재사용 가능한 컴포넌트를 제공합니다 [11-14]. 컴포넌트들이 글로벌 설정(예: 최대 20개 언어 번역)을 공유받기 위해서는 애플리케이션 최상단을 `<AppProvider>` 컴포넌트로 감싸야 합니다 [15, 16].
* **접근성([[Accessibility|Accessibility]]) 내장:** 이 디자인 시스템은 키보드 내비게이션, ARIA 라벨, 스크린 리더 호환성 등의 접근성 기능을 기본적으로 갖추고 있어, 모든 사용자를 위한 포용적이고 확장성 있는 UI 구축을 지원합니다 [6, 17, 18]. 접근성은 Polaris의 가장 기초적이고 중요한 기능 중 하나로 취급됩니다 [19].
* **장점:** 처음부터 UI 요소를 만들 필요가 없어 개발 속도가 빨라지며, Shopify 네이티브 디자인과 일치하여 상인(Merchant)들에게 일관되고 전문적인 경험을 제공합니다 [18]. 또한 오픈 소스로 공개되어 있어 서드파티 리소스 및 커뮤니티 지원을 받을 수 있습니다 [2, 18].
* **한계 및 단점:** 사용을 위해서는 React에 대한 지식이 필수적이며 Shopify의 업데이트에 의존적입니다 [20]. 또한 디자인 가이드라인이 매우 엄격하여 독창적인 커스텀 브랜딩이나 고도의 시각적 커스터마이징을 하려면 제약이 따르며, 일부 개발자들은 컴포넌트 종류가 부족하고 커스터마이징이 고통스러워 차라리 처음부터 새로 작성하는 것이 낫다고 평가하기도 합니다 [20, 21].
## 매 핵심
## 🔗 지식 연결 (Graph)
- **Related Topics:** React Component Libraries, [[Accessibility (A11y)|Accessibility (A11y]], Reusable UI Components, [[Design Systems|DesignSystems]]
- **Projects/Contexts:** Shopify App Development, Building Scalable React UI
- **Contradictions/Notes:** 소스 [6, 18, 22]는 Polaris가 사전 빌드된 컴포넌트를 통해 개발 시간을 크게 절약해 주고 구현이 쉽다고 긍정적으로 평가하지만, 소스 [20, 21]은 컴포넌트의 시각적 커스터마이징이 매우 어렵고 제한적이어서 원하는 디자인이 있을 경우 오히려 시간을 낭비하게 되며 아예 처음부터 새로 만들어야 할 수도 있다고 상반된/주의할 점을 지적합니다.
### 매 패키지
- `@shopify/polaris`: React components + tokens
- `@shopify/app-bridge-react`: 매 embedded app 의 host iframe API
- `@shopify/polaris-icons`: SVG icon set
---
*Last updated: 2026-04-26*
### 매 design principles
- "Built for Shopify" — merchant 가 Shopify Admin 에 익숙
- Workflow centric (page · card · resource list · index table)
- Accessibility first (WCAG 2.1 AA)
## 🤖 LLM 활용 힌트 (How to Use This Knowledge)
### 매 응용
1. Shopify Admin custom app (embedded).
2. Shopify storefront builder tools.
3. Internal merchant ops dashboards.
**언제 이 지식을 쓰는가:**
- *(TODO)*
## 💻 패턴
**언제 쓰면 안 되는가:**
- *(TODO)*
### App provider + i18n
```tsx
import { AppProvider, Page, Card, Text } from "@shopify/polaris";
import "@shopify/polaris/build/esm/styles.css";
import enTranslations from "@shopify/polaris/locales/en.json";
## 🧪 검증 상태 (Validation)
- **정보 상태:** needs_review
- **출처 신뢰도:** A
- **검토 이유:** *(P-Reinforce Phase 1 자동 정규화. 본문 검증 필요.)*
## 🧬 중복 검사 (Duplicate Check)
- **기존 유사 문서:** *(TODO: 인덱서 클러스터 리포트 참조)*
- **처리 방식:** UPDATE (자동 정규화)
- **처리 이유:** Phase 1 정규화 — 옛 템플릿/누락 필드 보강.
## ⚠️ 모순 및 업데이트 (Contradictions & Updates)
- **과거 데이터와의 충돌:** 없음
- **정책 변화:** 없음
## 🕓 변경 이력 (Changelog)
| 날짜 | 변경 내용 | 처리 방식 | 신뢰도 |
|------|-----------|-----------|--------|
| 2026-05-08 | P-Reinforce Phase 1 정규화 (frontmatter + 헤더 표준화) | UPDATE | A |
## 💻 코드 패턴 (Code Patterns)
**패턴 1:** *(TODO: 이 프로젝트 컨벤션 반영한 구조 스켈레톤)*
```text
# TODO
export default function App() {
return (
<AppProvider i18n={enTranslations}>
<Page title="Orders">
<Card>
<Text as="h2" variant="headingMd"> orders here</Text>
</Card>
</Page>
</AppProvider>
);
}
```
## 🤔 의사결정 기준 (Decision Criteria)
### Embedded app with App Bridge
```tsx
// app/providers.tsx
"use client";
import { AppProvider } from "@shopify/polaris";
import { Provider as AppBridge } from "@shopify/app-bridge-react";
import enTranslations from "@shopify/polaris/locales/en.json";
**선택 A를 써야 할 때:**
- *(TODO)*
export function Providers({
children, apiKey, host,
}: { children: React.ReactNode; apiKey: string; host: string }) {
return (
<AppBridge config={{ apiKey, host, forceRedirect: true }}>
<AppProvider i18n={enTranslations}>{children}</AppProvider>
</AppBridge>
);
}
```
**선택 B를 써야 할 때:**
- *(TODO)*
### IndexTable (Shopify-style data grid)
```tsx
import { IndexTable, Text, useIndexResourceState } from "@shopify/polaris";
**기본값:**
> *(TODO)*
const orders = [
{ id: "1001", customer: "Alice", total: "$120" },
{ id: "1002", customer: "Bob", total: "$45" },
];
## ❌ 안티패턴 (Anti-Patterns)
export function OrdersTable() {
const { selectedResources, allResourcesSelected, handleSelectionChange } =
useIndexResourceState(orders);
- **[안티패턴]:** *(TODO: 무엇을 하면 안 되는가 + 이유 + 대신 무엇을)*
return (
<IndexTable
resourceName={{ singular: "order", plural: "orders" }}
itemCount={orders.length}
selectedItemsCount={allResourcesSelected ? "All" : selectedResources.length}
onSelectionChange={handleSelectionChange}
headings={[{ title: "Order" }, { title: "Customer" }, { title: "Total" }]}
>
{orders.map((o, i) => (
<IndexTable.Row id={o.id} key={o.id} position={i}
selected={selectedResources.includes(o.id)}>
<IndexTable.Cell><Text as="span" fontWeight="bold">#{o.id}</Text></IndexTable.Cell>
<IndexTable.Cell>{o.customer}</IndexTable.Cell>
<IndexTable.Cell>{o.total}</IndexTable.Cell>
</IndexTable.Row>
))}
</IndexTable>
);
}
```
### Form + Banner + Toast
```tsx
import { Form, FormLayout, TextField, Button, Banner, Frame, Toast } from "@shopify/polaris";
import { useState, useCallback } from "react";
export function ProductForm() {
const [name, setName] = useState("");
const [error, setError] = useState<string>();
const [toast, setToast] = useState(false);
const submit = useCallback(async () => {
if (!name.trim()) { setError("매 name required"); return; }
setError(undefined);
// await api.create({ name });
setToast(true);
}, [name]);
return (
<Frame>
{error && <Banner tone="critical">{error}</Banner>}
<Form onSubmit={submit}>
<FormLayout>
<TextField label="Product name" value={name} onChange={setName} autoComplete="off" />
<Button submit variant="primary"> Save</Button>
</FormLayout>
</Form>
{toast && <Toast content="매 Saved" onDismiss={() => setToast(false)} />}
</Frame>
);
}
```
### Resource picker via App Bridge
```tsx
"use client";
import { useAppBridge } from "@shopify/app-bridge-react";
import { Button } from "@shopify/polaris";
export function PickProduct() {
const shopify = useAppBridge();
async function open() {
const selected = await shopify.resourcePicker({ type: "product", multiple: true });
if (selected) console.log("picked", selected);
}
return <Button onClick={open}> Choose products</Button>;
}
```
### Navigation
```tsx
import { Frame, Navigation } from "@shopify/polaris";
import { HomeIcon, OrderIcon, ProductIcon } from "@shopify/polaris-icons";
export function Shell({ children }: { children: React.ReactNode }) {
const nav = (
<Navigation location="/">
<Navigation.Section
items={[
{ url: "/", label: "Home", icon: HomeIcon },
{ url: "/orders", label: "Orders", icon: OrderIcon, badge: "12" },
{ url: "/products", label: "Products", icon: ProductIcon },
]}
/>
</Navigation>
);
return <Frame navigation={nav}>{children}</Frame>;
}
```
### Polaris tokens in custom CSS
```css
.custom-card {
background: var(--p-color-bg-surface);
color: var(--p-color-text);
padding: var(--p-space-400);
border-radius: var(--p-border-radius-200);
}
```
### Server Action with Polaris UI feedback
```tsx
"use client";
import { Button, Toast, Frame } from "@shopify/polaris";
import { useState, useTransition } from "react";
import { syncProducts } from "./actions";
export function SyncButton() {
const [pending, start] = useTransition();
const [done, setDone] = useState(false);
return (
<Frame>
<Button
loading={pending}
onClick={() => start(async () => { await syncProducts(); setDone(true); })}
> Sync</Button>
{done && <Toast content="매 Synced" onDismiss={() => setDone(false)} />}
</Frame>
);
}
```
## 매 결정 기준
| 상황 | Approach |
|---|---|
| Shopify embedded app | **Polaris + App Bridge** |
| Public storefront | Hydrogen (다른 stack) |
| Non-Shopify admin | shadcn/ui or other DS |
| Shopify ecosystem reuse | Polaris (familiarity) |
**기본값**: Shopify embedded app → Polaris v13 + App Bridge React 4.x. Storefront 는 Hydrogen.
## 🔗 Graph
- 부모: [[Design System]] · [[Component Libraries]]
- 변형: [[Material UI]] · [[Ant Design]] · [[Atlassian Design System]] · [[Carbon]] · [[shadcn/ui]]
- 응용: [[Shopify Admin Apps]] · [[Embedded Apps]]
- Adjacent: [[Shopify App Bridge]] · [[Hydrogen]] · [[Shopify Functions]]
## 🤖 LLM 활용
**언제**: Shopify embedded app scaffold, Shopify admin tooling, merchant-facing UX.
**언제 X**: Non-Shopify product (merchant-context UX 가 어색), 매 storefront (Hydrogen).
## ❌ 안티패턴
- **Polaris outside Shopify**: 매 brand bleed — non-Shopify product 에 Polaris UI.
- **Skipping AppProvider**: i18n / theme 깨짐.
- **Custom UI for embedded**: 매 merchant 혼동 — Polaris 우선.
- **Forgetting App Bridge**: embedded app 에서 navigation/resource picker 못함.
- **Bypassing tokens**: hex code 직접 → dark mode 깨짐.
## 🧪 검증 / 중복
- Verified (polaris.shopify.com docs, App Bridge React docs, 2026).
- 신뢰도 A.
## 🕓 Changelog
| 날짜 | 변경 |
|---|---|
| 2026-05-08 | Phase 1 |
| 2026-05-10 | Manual cleanup — Shopify Polaris full content |