Improve responsive UI presentation
This commit is contained in:
parent
a948542326
commit
2386174d9a
|
|
@ -6,15 +6,15 @@ import { copyToClipboard } from "../lib/clipboard"
|
||||||
/** Фрагмент кода с кнопкой копирования. */
|
/** Фрагмент кода с кнопкой копирования. */
|
||||||
export function CodeBlock({ code, className }: { code: string; className?: string }) {
|
export function CodeBlock({ code, className }: { code: string; className?: string }) {
|
||||||
return (
|
return (
|
||||||
<div className={cn("group relative", className)}>
|
<div className={cn("relative", className)}>
|
||||||
<pre className="overflow-x-auto rounded-xl bg-muted/70 p-4 font-mono text-ui leading-relaxed text-foreground/90">
|
<pre className="overflow-x-auto rounded-xl border bg-muted/60 p-3 pr-12 font-mono text-ui leading-relaxed text-foreground/90 sm:p-4 sm:pr-12">
|
||||||
<code>{code}</code>
|
<code>{code}</code>
|
||||||
</pre>
|
</pre>
|
||||||
<button
|
<button
|
||||||
type="button"
|
type="button"
|
||||||
aria-label="Скопировать код"
|
aria-label="Скопировать код"
|
||||||
onClick={() => copyToClipboard(code, "Код скопирован")}
|
onClick={() => copyToClipboard(code, "Код скопирован")}
|
||||||
className="absolute top-2 right-2 grid size-7 place-items-center rounded-md bg-card text-muted-foreground opacity-0 shadow-xs transition group-hover:opacity-100 hover:text-foreground"
|
className="absolute top-2 right-2 grid size-7 place-items-center rounded-md border bg-card text-muted-foreground shadow-xs transition hover:text-foreground focus:ring-[3px] focus:ring-ring/50 focus:outline-none"
|
||||||
>
|
>
|
||||||
<CopyIcon className="size-3.5" />
|
<CopyIcon className="size-3.5" />
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ export function PageFrame({
|
||||||
actions,
|
actions,
|
||||||
toolbar,
|
toolbar,
|
||||||
scroll = true,
|
scroll = true,
|
||||||
|
showTitleOnMobile = false,
|
||||||
className,
|
className,
|
||||||
children,
|
children,
|
||||||
}: {
|
}: {
|
||||||
|
|
@ -28,6 +29,8 @@ export function PageFrame({
|
||||||
toolbar?: React.ReactNode
|
toolbar?: React.ReactNode
|
||||||
/** false — тело само управляет прокруткой (списки с панелью деталей). */
|
/** false — тело само управляет прокруткой (списки с панелью деталей). */
|
||||||
scroll?: boolean
|
scroll?: boolean
|
||||||
|
/** Не скрывать текст заголовка рядом с иконкой на узком экране. */
|
||||||
|
showTitleOnMobile?: boolean
|
||||||
className?: string
|
className?: string
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
}) {
|
}) {
|
||||||
|
|
@ -40,7 +43,7 @@ export function PageFrame({
|
||||||
<header className="flex h-12 shrink-0 items-center gap-2 border-b px-2">
|
<header className="flex h-12 shrink-0 items-center gap-2 border-b px-2">
|
||||||
<h1 className="flex h-8 min-w-0 items-center gap-2 rounded-lg bg-accent px-2.5 text-sm font-medium text-accent-foreground">
|
<h1 className="flex h-8 min-w-0 items-center gap-2 rounded-lg bg-accent px-2.5 text-sm font-medium text-accent-foreground">
|
||||||
{Icon && <Icon className="size-4 shrink-0 text-primary" />}
|
{Icon && <Icon className="size-4 shrink-0 text-primary" />}
|
||||||
<span className={cn("truncate", Icon && "max-md:sr-only")}>{title}</span>
|
<span className={cn("truncate", Icon && !showTitleOnMobile && "max-md:sr-only")}>{title}</span>
|
||||||
</h1>
|
</h1>
|
||||||
<div className={cn("ml-auto flex shrink-0 items-center gap-2", FRAME_ACTIONS_CLASS)}>
|
<div className={cn("ml-auto flex shrink-0 items-center gap-2", FRAME_ACTIONS_CLASS)}>
|
||||||
{actions}
|
{actions}
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ export function PatientPanel<T extends string>({
|
||||||
const fullName = [p.lastName, p.firstName, p.middleName].filter(Boolean).join(" ")
|
const fullName = [p.lastName, p.firstName, p.middleName].filter(Boolean).join(" ")
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className={cn("shrink-0", className)}>
|
<div className={cn("@container/patient-panel shrink-0", className)}>
|
||||||
<header className="relative overflow-hidden border-b">
|
<header className="relative overflow-hidden border-b">
|
||||||
<div
|
<div
|
||||||
className={cn(
|
className={cn(
|
||||||
|
|
@ -115,7 +115,11 @@ export function PatientPanel<T extends string>({
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{actions && <div className="flex min-w-0 flex-wrap items-center gap-2 max-sm:w-full">{actions}</div>}
|
{actions && (
|
||||||
|
<div className="flex min-w-0 flex-wrap items-center gap-2 @max-[760px]/patient-panel:w-full @max-[760px]/patient-panel:justify-start">
|
||||||
|
{actions}
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue