Implement ProgCode identity and real shared reading UI kit
Build and deploy / deploy (push) Successful in 2m39s

This commit is contained in:
huncode committed 2026-10-27 15:19:49 +03:00
1 parent 99c848189e
commit 12562baeb5
2040 files changed
+184656 -181

No files matched your search

@@ -0,0 +1,34 @@
import Link from 'next/link';
const classes=(...names)=>names.filter(Boolean).join(' ');
export function Brand({symbol=false,className='',...props}){
return <Link {...props} href="/" aria-label="ProgCode — главная" className={classes('brand',symbol&&'brand-symbol',className)}>{symbol?<img src="/brand/favicon.svg" width="32" height="32" alt="" aria-hidden="true"/>:<><img className="brand-light" src="/brand/logo-light.svg" width="224" height="44" alt="" aria-hidden="true"/><img className="brand-dark" src="/brand/logo-dark.svg" width="224" height="44" alt="" aria-hidden="true"/></>}</Link>;
}
export function Button({variant='primary',type='button',className='',children,...props}){
const kind=variant==='secondary'?'secondary':'primary';
return <button {...props} type={type} className={classes('ui-button',kind,className)} data-variant={kind}>{children}</button>;
}
export function ActionLink({href,children,variant='primary',className='',...props}){
const kind=variant==='secondary'?'secondary':'primary';
return <Link {...props} href={href} className={classes('ui-button','ui-action-link',kind,className)} data-variant={kind}>{children}</Link>;
}
export function TextLink({href,children,className='',...props}){return <Link {...props} href={href} className={classes('ui-text-link',className)}>{children}</Link>;}
function descriptions(existing,hintId){return [existing,hintId].filter(Boolean).join(' ')||undefined;}
export function Field({id,label,hint,className='',...inputProps}){
const hintId=hint?`${id}-hint`:undefined;
return <div className="field"><label className="field-label" htmlFor={id}>{label}</label><input {...inputProps} id={id} className={classes('field-control',className)} aria-describedby={descriptions(inputProps['aria-describedby'],hintId)}/>{hint&&<p id={hintId} className="field-note">{hint}</p>}</div>;
}
export function TextArea({id,label,hint,className='',...textareaProps}){
const hintId=hint?`${id}-hint`:undefined;
return <div className="field field-textarea"><label className="field-label" htmlFor={id}>{label}</label><textarea {...textareaProps} id={id} className={classes('field-control',className)} aria-describedby={descriptions(textareaProps['aria-describedby'],hintId)}/>{hint&&<p id={hintId} className="field-note">{hint}</p>}</div>;
}
export function StatusMessage({tone='neutral',children,id,className='',...props}){
const kind=['neutral','success','error'].includes(tone)?tone:'neutral';
return <p {...props} id={id} role="status" aria-live="polite" aria-atomic="true" className={classes('status-message',kind,className)} data-tone={kind}>{children}</p>;
}
export function ScrollRegion({label,children,className='',tabIndex=0,...props}){return <div {...props} className={classes('scroll-region',className)} tabIndex={tabIndex} role="region" aria-label={label}>{children}</div>;}
// html must be the reviewed build-generated publication HTML, never an untrusted input.
export function Prose({children,html,className='',...props}){
const attrs={...props,className:classes('prose','article-content',className)};
return typeof html==='string'?<div {...attrs} dangerouslySetInnerHTML={{__html:html}}/>:<div {...attrs}>{children}</div>;
}
export function Tag({children,className='',...props}){return <span {...props} className={classes('ui-tag',className)}>{children}</span>;}