Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions apps/showcase/src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import { isValidSchema } from './constants.js';
import './components/sc-nav.js';

// Page imports
// TODO(line-ui-6zy.3): home page is imported but not rendered — wire into panel system when home page task is implemented
import './pages/home.js';
import './pages/colors.js';
import './pages/typography.js';
Expand All @@ -25,6 +24,7 @@ import './pages/themes.js';
import './pages/generator.js';

export type PanelKey =
| 'home'
| 'colors'
| 'typography'
| 'spacing'
Expand All @@ -38,7 +38,7 @@ export type PanelKey =

@customElement('sc-app')
export class ScApp extends LitElement {
@state() private _panel: PanelKey = 'colors';
@state() private _panel: PanelKey = 'home';
@state() private _schema = 'violet';
@state() private _light = false;

Expand Down Expand Up @@ -73,12 +73,13 @@ export class ScApp extends LitElement {
override connectedCallback(): void {
super.connectedCallback();

// Restore persisted mode
// Restore persisted mode — fall back to OS preference
const storedMode = localStorage.getItem('line-mode');
if (storedMode === 'light') {
this._light = true;
if (storedMode === 'light' || storedMode === 'dark') {
this._light = storedMode === 'light';
} else {
this._light = window.matchMedia('(prefers-color-scheme: light)').matches;
}
// Default is dark (light = false)
this._applyMode();

// Restore persisted schema
Expand All @@ -97,6 +98,7 @@ export class ScApp extends LitElement {

private _isValidPanel(value: string): value is PanelKey {
return [
'home',
'colors',
'typography',
'spacing',
Expand Down Expand Up @@ -177,6 +179,8 @@ export class ScApp extends LitElement {

private _renderPanel() {
switch (this._panel) {
case 'home':
return html`<sc-page-home ?light=${this._light}></sc-page-home>`;
case 'colors':
return html`<sc-page-colors></sc-page-colors>`;
case 'typography':
Expand Down
4 changes: 3 additions & 1 deletion apps/showcase/src/components/sc-nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import type { PanelKey } from '../app.js';
import { ALL_SCHEMAS } from '../constants.js';

const NAV_ITEMS: { key: PanelKey; label: string }[] = [
{ key: 'home', label: 'Home' },
{ key: 'colors', label: 'Colors' },
{ key: 'typography', label: 'Typography' },
{ key: 'spacing', label: 'Spacing' },
Expand Down Expand Up @@ -74,6 +75,7 @@ export class ScNav extends LitElement {
letter-spacing: -0.03em;
white-space: nowrap;
flex-shrink: 0;
cursor: pointer;
transition: color var(--line-duration-moderate-1, 180ms) var(--line-ease-2);
}
:host([light]) .logo { color: var(--line-high-contrast, #1a1a1a); }
Expand Down Expand Up @@ -419,7 +421,7 @@ export class ScNav extends LitElement {

return html`
<div class="topbar">
<div class="logo">line<span class="logo-ac">://</span>ui</div>
<div class="logo" @click=${() => this._navigate('home' as PanelKey)}>line<span class="logo-ac">://</span>ui</div>

<!-- Desktop: inline pill nav -->
<div class="nav-inline">
Expand Down
Loading
Loading