Implement ProgCode identity and real shared reading UI kit
Build and deploy / deploy (push) Successful in 2m39s
Build and deploy / deploy (push) Successful in 2m39s
This commit is contained in:
1 parent
99c848189e
commit
12562baeb5
2040 files changed
+184656
-181
No files matched your search
@@ -0,0 +1,3 @@
|
||||
import {Prose} from '../../shared/ui';
|
||||
import {ContentAccess} from '../../features/content-access';
|
||||
export default function ArticleReader({article,related}){return <div className="reading-layout">{article.toc?.length>1&&<aside className="contents-rail"><details open><summary>В этой статье</summary><nav aria-label="Оглавление статьи">{article.toc.map((section,index)=><a key={section.id} href={'#'+section.id}><span>{String(index+1).padStart(2,'0')}</span>{section.title}</a>)}</nav></details></aside>}<div className="reading-column"><Prose html={article.contentHtml}/><ContentAccess/><div className="article-end"><span>КОНЕЦ ЗАМЕТКИ</span><a href="#main">↑ В начало</a></div>{related}</div></div>}
|
||||
@@ -0,0 +1,4 @@
|
||||
"use client";
|
||||
import {JournalSearch} from '../../features/journal-search';
|
||||
import {trackGoal} from '../../features/analytics';
|
||||
export default function JournalIndex({articles}){return <JournalSearch articles={articles} onResultSelect={()=>trackGoal('search_used')} onZeroResults={()=>trackGoal('search_zero_results')}/>}
|
||||
@@ -0,0 +1,2 @@
|
||||
import {JsonEditor} from '../../features/json-editor';
|
||||
export default function JsonWorkbench(){return <JsonEditor/>}
|
||||
@@ -0,0 +1,2 @@
|
||||
import {TextLink} from '../../shared/ui';
|
||||
export default function MechanismMap({href}){return <aside className="mechanism" aria-labelledby="mechanism-title"><p className="mono" id="mechanism-title">ПАМЯТЬ / УПРОЩЁННАЯ МОДЕЛЬ MARK–SWEEP</p><div className="memory-map" role="img" aria-label="От корней есть путь к A, затем к B. К C пути нет."><span className="memory-root">Корни</span><span className="memory-arrow" aria-hidden="true">→</span><span className="memory-reachable">A</span><span className="memory-arrow" aria-hidden="true">→</span><span className="memory-reachable">B</span><span className="memory-unreachable">C <small>нет пути</small></span></div><p><strong>MARK</strong> отмечает A и B.<br/><strong>SWEEP</strong> освобождает блок C.</p><p className="mechanism-note">Корни — стек, регистры и данные. Финализаторы и ложные указатели усложняют реализацию; это схема из разбора 2017 года.</p><TextLink href={href}>Как устроен сбор →</TextLink></aside>}
|
||||
@@ -0,0 +1,5 @@
|
||||
'use client';
|
||||
import {useEffect,useState} from 'react';
|
||||
import {Button,TextLink,StatusMessage} from '../../shared/ui';
|
||||
export function BuildIdentity(){const [identity,setIdentity]=useState(null);useEffect(()=>{let active=true;fetch('/build-identity.json').then(r=>r.ok?r.json():Promise.reject()).then(v=>{if(active)setIdentity(v.sourceHash)}).catch(()=>{});return()=>{active=false}},[]);return <p className="build-identity">Исходники этой сборки: <code>{identity||'загрузка идентификатора…'}</code></p>}
|
||||
export default function PagePreview({pages}){const [selected,setSelected]=useState(0),[width,setWidth]=useState(390),[opened,setOpened]=useState(false);const item=pages[selected]||pages[0];return <section className="page-preview"><p>Откройте настоящие страницы. Встроенное сравнение ниже — необязательный инструмент проверки системы, а не отдельный макет.</p><nav aria-label="Полные реальные страницы"><ul className="real-page-links">{pages.map(p=><li key={p.href}><TextLink href={p.href}>{p.title}</TextLink></li>)}</ul></nav><details className="preview-utility"><summary>Сравнить полную страницу в контейнере</summary><details className="preview-page-picker"><summary>Страница: {item.title}</summary><ul>{pages.map((p,i)=><li key={p.href}><Button variant="secondary" aria-pressed={selected===i} onClick={()=>{setSelected(i);setOpened(false)}}>{p.title}</Button></li>)}</ul></details><div className="preview-controls"><div role="group" aria-label="Ширина превью" className="uikit-actions">{[320,390,1440].map(v=><Button key={v} variant="secondary" aria-pressed={width===v} onClick={()=>setWidth(v)}>{v} px</Button>)}</div><Button onClick={()=>setOpened(true)}>Показать страницу</Button><TextLink href={item.href}>Открыть отдельно →</TextLink></div><p>{item.reason}</p>{opened?<div className="page-preview-region" tabIndex={0} role="region" aria-label="Полная страница; при необходимости прокручивается по горизонтали"><iframe title={item.title} src={item.href} style={{width,height:850}}/></div>:<StatusMessage>Выбранная страница использует ту же сборку и тему. Нажмите «Показать страницу» для встроенного просмотра.</StatusMessage>}</details></section>}
|
||||
@@ -0,0 +1,3 @@
|
||||
import Link from 'next/link';
|
||||
import {articleHref,articleGenre,readingConnections} from '../../entities/article';
|
||||
export default function RelatedReading({article,articles}){const connections=article?readingConnections(article,articles):[];if(!connections.length)return <section className="related"><p className="kicker">К СЛЕДУЮЩЕМУ ВОПРОСУ</p><Link href="/#journal">Найти материал в указателе →</Link></section>;return <section className="related" aria-label="Продолжить по смыслу"><p className="kicker">К СЛЕДУЮЩЕМУ ВОПРОСУ</p>{connections.map(({article:item,reason})=><Link className="continuation" key={item.slug} href={articleHref(item)}><span className="tiny-topic">{articleGenre(item)} · {item.categories.join(' / ')}</span><strong>{item.title}</strong><span className="reason">{reason}</span><span aria-hidden="true">→</span></Link>)}</section>}
|
||||
@@ -0,0 +1,5 @@
|
||||
import Link from 'next/link';
|
||||
import {Brand} from '../../shared/ui';
|
||||
import {ThemeControl} from '../../features/theme-selection';
|
||||
export function SiteHeader(){return <header className="masthead"><Brand/><nav aria-label="Главная навигация"><Link href="/#journal">Статьи</Link><Link href="/resources/">Справочники</Link><Link href="/tools/">JSON</Link><Link href="/about/">О блоге</Link></nav><ThemeControl/></header>}
|
||||
export function SiteFooter(){return <footer className="footer"><Brand/><p>Заметки о том, как устроен код.<br/>D, PHP, Bitrix и веб-разработка.</p><nav aria-label="Информация о проекте"><Link href="/#journal">Все статьи</Link><Link href="/sources/">Источники и редактура</Link><Link href="/privacy/">Приватность</Link><Link href="/accessibility/">Доступность и чтение</Link><Link href="/ui-kit/">Компоненты ProgCode</Link></nav><span>Материалы 2017–2019</span></footer>}
|
||||
Reference in new issue
Block a user