예제 화면 4곳이 제목 위에 같은 "예제" 라벨을 달았다. 이미 예제 메뉴 묶음 안에 있는 화면이라 정보가 없고, 예제를 복사하면 이 구성도 따라간다. 예제 화면의 eyebrow만 지웠다. PageHeader의 eyebrow 속성은 남겼다. 접근 상태 화면과 홈은 의미 있는 라벨을 쓴다. 검사는 넣지 않았다. 지울 수 있는 예제 화면의 문구라 검사 비용이 더 크다. 위험: 없음. 예제 화면은 i18n 검사 대상이 아니다. 검증: lint, check:types:app 통과. 시각 골든에 반영했다.
61 lines
2.0 KiB
TypeScript
61 lines
2.0 KiB
TypeScript
import { PageHeader } from "../design-system/index.ts";
|
|
import {
|
|
useSession,
|
|
useSessionAction,
|
|
} from "../providers/session-provider.tsx";
|
|
|
|
export default function AuthExamplePage() {
|
|
const { sessionState } = useSession();
|
|
const { pending, failed, run } = useSessionAction();
|
|
|
|
return (
|
|
<section className="ui-page">
|
|
<PageHeader
|
|
title="인증 연동"
|
|
description="스켈레톤은 자격 증명을 소유하지 않고 외부 인증 구현이 연결될 포트와 화면 상태만 제공합니다."
|
|
/>
|
|
<section className="ui-panel auth-example" aria-labelledby="auth-state-title">
|
|
<div>
|
|
<h2 id="auth-state-title">현재 세션 상태</h2>
|
|
<output className="session-status" data-state={sessionState}>
|
|
{sessionState}
|
|
</output>
|
|
</div>
|
|
<div className="button-row">
|
|
<button
|
|
className="ui-button"
|
|
type="button"
|
|
disabled={pending || sessionState === "integration-failed"}
|
|
onClick={() => run("sign-in")}
|
|
>
|
|
로그인 시작
|
|
</button>
|
|
<button
|
|
className="ui-button ui-button--secondary"
|
|
type="button"
|
|
disabled={pending || sessionState !== "authenticated"}
|
|
onClick={() => run("sign-out")}
|
|
>
|
|
로그아웃
|
|
</button>
|
|
<button
|
|
className="ui-button ui-button--secondary"
|
|
type="button"
|
|
disabled={pending || sessionState !== "recovery-pending"}
|
|
onClick={() => run("recover")}
|
|
>
|
|
세션 복구
|
|
</button>
|
|
</div>
|
|
{sessionState === "integration-failed" ? (
|
|
<p role="status">
|
|
외부 인증 소유자가 연결되지 않았습니다. 런타임 호스트의 인증
|
|
계약을 연결하세요.
|
|
</p>
|
|
) : null}
|
|
{failed ? <p role="alert">인증 작업을 완료하지 못했습니다.</p> : null}
|
|
</section>
|
|
</section>
|
|
);
|
|
}
|