docs(storybook): tidy SW Home Menu page and hide the Viewer comparison
Deploy Storybook / deploy (push) Successful in 1m13s
Deploy Storybook / deploy (push) Successful in 1m13s
Home Menu: the recent-files sub panel loses its title / Figma node caption and its frame fits the open panel (+16px) instead of a fixed 860px; the Integration (property window / SWPopup / Escape) section leaves the page and stays in the hidden home-menu-integration Story. SW Viewer: SWHeader vs Viewer Header is tagged verification (ID and URL kept for the browser tests); inventory and README updated.
This commit is contained in:
1 parent
625cdf0045
commit
a51c0e87da
4 files changed
+38
-10
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { useState, type ReactNode } from "react"
|
||||
import { useLayoutEffect, useRef, useState, type ReactNode } from "react"
|
||||
import type { Meta, StoryObj } from "@storybook/react-vite"
|
||||
// Public API only, like a consuming project.
|
||||
import {
|
||||
@@ -85,7 +85,33 @@ function HeaderWithMenu({ width, defaultOpen = false, defaultActiveIds = [], acc
|
||||
)
|
||||
}
|
||||
|
||||
/** The sidebar Story: the logo menu of SWHeader (SW normal mode) with its Figma states, sub panel and Escape stack. */
|
||||
/**
|
||||
* Story layout only: the open sub panel is absolutely placed, so the frame takes the panel's measured bottom (+16px)
|
||||
* instead of a fixed tall height. The panel wraps taller at narrow widths; closing it returns the frame to its CSS height.
|
||||
*/
|
||||
function FitToPanel({ children }: { children: ReactNode }) {
|
||||
const ref = useRef<HTMLDivElement>(null)
|
||||
useLayoutEffect(() => {
|
||||
const root = ref.current
|
||||
if (!root) return
|
||||
const fit = () => {
|
||||
const frame = root.querySelector<HTMLElement>(".sw-home-menu-story__frame")
|
||||
const panel = root.querySelector(".hm-sw-home-menu__more-panel")
|
||||
if (!frame) return
|
||||
const height = panel ? `${Math.ceil(panel.getBoundingClientRect().bottom - frame.getBoundingClientRect().top) + 16}px` : ""
|
||||
if (frame.style.height !== height) frame.style.height = height
|
||||
}
|
||||
fit()
|
||||
const resize = new ResizeObserver(fit)
|
||||
resize.observe(root)
|
||||
const mutation = new MutationObserver(fit)
|
||||
mutation.observe(root, { childList: true, subtree: true })
|
||||
return () => { resize.disconnect(); mutation.disconnect() }
|
||||
}, [])
|
||||
return <div ref={ref}>{children}</div>
|
||||
}
|
||||
|
||||
/** The sidebar Story: the logo menu of SWHeader (SW normal mode) with its Figma states and sub panel (the Escape stack demo is the hidden Integration Story). */
|
||||
export const HomeMenu: Story = {
|
||||
name: "Home Menu",
|
||||
render: () => (
|
||||
@@ -97,12 +123,10 @@ export const HomeMenu: Story = {
|
||||
<StorySection title="열림 (현재 폭)" description="로고 Home On · Header 상·하단 2px 선">
|
||||
<HeaderWithMenu defaultOpen autoFocus={false} />
|
||||
</StorySection>
|
||||
<StorySection title="최근파일 하위 패널 (662:67267)" description="미리보기는 빈 영역 · 목록은 Story 데이터">
|
||||
<div className="sw-home-menu-story__tall"><HeaderWithMenu defaultOpen autoFocus={false} defaultActiveIds={["recent"]}>{log => log}</HeaderWithMenu></div>
|
||||
</StorySection>
|
||||
<StorySection title="통합 · 속성창 · SWPopup · Escape" description="Escape는 Focus 위치부터 닫고, 밖에서는 가장 최근 하나만 닫음">
|
||||
<IntegrationDemo />
|
||||
</StorySection>
|
||||
{/* No section heading: the open recent-files panel follows the "열림" section directly. */}
|
||||
<section className="sb-page-section" aria-label="최근파일 하위 패널">
|
||||
<FitToPanel><HeaderWithMenu defaultOpen autoFocus={false} defaultActiveIds={["recent"]}>{log => log}</HeaderWithMenu></FitToPanel>
|
||||
</section>
|
||||
</StoryPage>
|
||||
),
|
||||
}
|
||||
|
||||
@@ -368,8 +368,10 @@ function ModeSwitchDemo() {
|
||||
)
|
||||
}
|
||||
|
||||
// 2026-10-22 (user request): removed from the sidebar; ID and direct URL kept for the viewer browser tests.
|
||||
export const CompareWithSWHeader: Story = {
|
||||
name: "SWHeader vs Viewer Header",
|
||||
tags: ["verification"],
|
||||
render: () => (
|
||||
<StoryPage>
|
||||
<StoryPageHeader title="SW Viewer — 일반 SW Header와 비교" />
|
||||
|
||||
Reference in new issue
Block a user