بلاک‌ها · پشتیبانی و محتوا
ری‌اکت ۱۹ و Next.js با پیاده‌سازی دسترس‌پذیری داخلی دیگویو ۳ با Composition APISvelte ۵ با runesانگولار با signals و دایرکتیوهای standaloneجتپک کامپوز با KotliniOS — هنوز پورت نشده

مستندات: فهرستِ راهنماها با صفحهٔ فعال، مسیرِ صفحه، گام‌های شماره‌دار، فهرستِ مطالبِ چسبان و «این راهنما مفید بود؟».

۱. نصب کامپوننت‌ها

این بلاک از ۴ آیتم دیگ استفاده می‌کند: breadcrumbbuttoncontrol-sizeicons

پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add https://docs.digdesign.ir/r/breadcrumb.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json
pnpm dlx digdesign@latest add https://docs.digdesign.ir/r/breadcrumb.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json
yarn dlx digdesign@latest add https://docs.digdesign.ir/r/breadcrumb.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json
bunx --bun digdesign@latest add https://docs.digdesign.ir/r/breadcrumb.json https://docs.digdesign.ir/r/button.json https://docs.digdesign.ir/r/control-size.json https://docs.digdesign.ir/r/icons.json
پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add breadcrumb button control-size --framework vue
pnpm dlx digdesign@latest add breadcrumb button control-size --framework vue
yarn dlx digdesign@latest add breadcrumb button control-size --framework vue
bunx --bun digdesign@latest add breadcrumb button control-size --framework vue
پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add button --framework svelte
pnpm dlx digdesign@latest add button --framework svelte
yarn dlx digdesign@latest add button --framework svelte
bunx --bun digdesign@latest add button --framework svelte
پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add breadcrumb button control-size icons --framework angular
pnpm dlx digdesign@latest add breadcrumb button control-size icons --framework angular
yarn dlx digdesign@latest add breadcrumb button control-size icons --framework angular
bunx --bun digdesign@latest add breadcrumb button control-size icons --framework angular
پکیج‌منیجر پیش‌فرض Node.jsنصب سریع با لینک سخت و دیسک مشترکYarn نسخهٔ ۲ به بالا (Berry)رانتایم و پکیج‌منیجر Bun
npx digdesign@latest add breadcrumb button control-size --framework android
pnpm dlx digdesign@latest add breadcrumb button control-size --framework android
yarn dlx digdesign@latest add breadcrumb button control-size --framework android
bunx --bun digdesign@latest add breadcrumb button control-size --framework android

۲. کد صفحه

کد را در صفحهٔ پروژه‌تان بگذارید (React: app/<route>/page.tsx) و متن‌ها، داده و هندلرها را با محصول خودتان عوض کنید. با سوییچر فریم‌ورک کدِ همین صفحه در فریم‌ورک دیگر را ببینید.

article-docs.tsx
"use client"

import * as React from "react"

import { ChevronDownIcon, ThumbsDownIcon, ThumbsUpIcon } from "@/components/icons"
import { Breadcrumb, BreadcrumbItem, BreadcrumbLink, BreadcrumbList, BreadcrumbPage, BreadcrumbSeparator } from "@/components/ui/breadcrumb"
import { Button } from "@/components/ui/button"
import { ControlSizeProvider } from "@/components/ui/control-size"
import { useActiveSection } from "@/hooks/use-active-section"

const TOC = [
  { id: "need", title: "پیش از شروع" },
  { id: "steps", title: "مراحلِ ساختِ فاکتور" },
  { id: "send", title: "ارسال برای مشتری" },
  { id: "faq", title: "خطاهای رایج" },
]
const NAV = ["شروعِ کار", "ساختِ فاکتور", "ارسالِ پیامکی", "گزارش‌ها", "تنظیماتِ مالیات"]

/**
 * مقالهٔ راهنما (مستندات): فهرستِ راهنماها در ستونِ راست با صفحهٔ فعال، متن با مسیرِ
 * صفحه و گام‌های شماره‌دار، فهرستِ مطالب در ستونِ چپ، و «این راهنما مفید بود؟» در پایان.
 */
export default function ArticleDocsBlock() {
  const [vote, setVote] = React.useState<"up" | "down" | null>(null)
  const activeSection = useActiveSection(TOC.map((item) => item.id))

  return (
    <ControlSizeProvider size="xl" asChild>
      <main className="mx-auto grid w-full max-w-6xl grid-cols-1 items-start gap-10 p-4 sm:p-6 lg:grid-cols-[13rem_minmax(0,1fr)_12rem]">
        <nav aria-label="راهنماها" className="hidden flex-col gap-1 lg:flex lg:sticky lg:top-6">
          {NAV.map((item) => (
            <a
              key={item}
              href="#"
              aria-current={item === "ساختِ فاکتور" ? "page" : undefined}
              className={`rounded-lg px-3 py-2.5 text-sm ${item === "ساختِ فاکتور" ? "bg-primary-subtle font-semibold" : "text-muted-foreground hover:bg-subtle hover:text-foreground"}`}
            >
              {item}
            </a>
          ))}
        </nav>
        <article className="flex flex-col gap-8">
          <Breadcrumb>
            <BreadcrumbList>
              <BreadcrumbItem>
                <BreadcrumbLink href="#">راهنما</BreadcrumbLink>
              </BreadcrumbItem>
              <BreadcrumbSeparator />
              <BreadcrumbItem>
                <BreadcrumbPage>ساختِ فاکتور</BreadcrumbPage>
              </BreadcrumbItem>
            </BreadcrumbList>
          </Breadcrumb>
          {/* در موبایل ستون‌های کناری پنهان‌اند؛ راهنماهای دیگر و فهرستِ مطالب در یک بازشو. */}
          <details className="group rounded-xl border border-border bg-card lg:hidden">
            <summary className="flex min-h-12 cursor-pointer list-none items-center justify-between gap-3 px-4 text-sm font-medium [&::-webkit-details-marker]:hidden">
              فهرستِ راهنما و مطالب
              <ChevronDownIcon aria-hidden className="size-4 text-muted-foreground transition-transform group-open:rotate-180" />
            </summary>
            <div className="grid grid-cols-1 gap-4 border-t border-border p-4 sm:grid-cols-2">
              <nav aria-label="راهنماها (موبایل)" className="flex flex-col gap-1">
                <span className="px-3 pb-1 text-xs font-medium text-muted-foreground">راهنماها</span>
                {NAV.map((item) => (
                  <a key={item} href="#" aria-current={item === "ساختِ فاکتور" ? "page" : undefined} className={`flex min-h-11 items-center rounded-lg px-3 text-sm ${item === "ساختِ فاکتور" ? "bg-primary-subtle font-semibold" : "text-muted-foreground"}`}>
                    {item}
                  </a>
                ))}
              </nav>
              <nav aria-label="در این صفحه (موبایل)" className="flex flex-col gap-1">
                <span className="px-3 pb-1 text-xs font-medium text-muted-foreground">در این صفحه</span>
                {TOC.map((item) => (
                  <a key={item.id} href={`#${item.id}`} aria-current={activeSection === item.id ? "location" : undefined} className={`flex min-h-11 items-center rounded-lg px-3 text-sm ${activeSection === item.id ? "bg-primary-subtle font-semibold text-primary-subtle-foreground" : "text-muted-foreground"}`}>
                    {item.title}
                  </a>
                ))}
              </nav>
            </div>
          </details>
          <header className="flex flex-col gap-3">
            <h1 className="text-3xl font-bold">ساختِ اولین فاکتور</h1>
            <p className="text-lg leading-8 text-muted-foreground">در کمتر از دو دقیقه فاکتورِ رسمی بساز و برای مشتری بفرست.</p>
          </header>
          <section id="need" className="flex flex-col gap-3 scroll-mt-6">
            <h2 className="text-xl font-bold">پیش از شروع</h2>
            <p className="leading-8 text-muted-foreground">اطلاعاتِ شرکت و لوگو را در «تنظیمات ← کسب‌وکار» کامل کن تا روی فاکتور بیاید.</p>
          </section>
          <section id="steps" className="flex flex-col gap-4 scroll-mt-6">
            <h2 className="text-xl font-bold">مراحلِ ساختِ فاکتور</h2>
            <ol className="flex flex-col gap-4">
              {["از منوی «فاکتورها» دکمهٔ «فاکتورِ تازه» را بزن.", "مشتری را انتخاب کن یا تازه بساز.", "اقلام، تعداد و تخفیف را وارد کن؛ مالیات خودش حساب می‌شود.", "«ذخیره» را بزن؛ شماره خودکار می‌گیرد."].map((step, index) => (
                <li key={step} className="flex gap-4">
                  <span aria-hidden className="flex size-8 shrink-0 items-center justify-center rounded-full bg-subtle text-sm font-bold">
                    {"۱۲۳۴"[index]}
                  </span>
                  <span className="pt-1 leading-7">{step}</span>
                </li>
              ))}
            </ol>
          </section>
          <section id="send" className="flex flex-col gap-3 scroll-mt-6">
            <h2 className="text-xl font-bold">ارسال برای مشتری</h2>
            <p className="leading-8 text-muted-foreground">در صفحهٔ فاکتور «ارسال» را بزن؛ مشتری پیامکی با لینکِ مشاهده و پرداخت می‌گیرد.</p>
          </section>
          <section id="faq" className="flex flex-col gap-3 rounded-xl bg-subtle p-5 scroll-mt-6">
            <h2 className="font-bold">خطاهای رایج</h2>
            <p className="text-sm leading-7 text-muted-foreground">«شمارهٔ مشتری نامعتبر است»: شماره باید با ۰۹ شروع شود و ۱۱ رقم باشد.</p>
          </section>
          <div className="flex flex-wrap items-center gap-4 border-t border-border pt-8" aria-live="polite">
            {vote ? (
              <span className="text-sm">ممنون از بازخوردت!</span>
            ) : (
              <>
                <span className="text-sm font-medium">این راهنما مفید بود؟</span>
                <Button variant="outline" onClick={() => setVote("up")}>
                  <ThumbsUpIcon />
                  بله
                </Button>
                <Button variant="outline" onClick={() => setVote("down")}>
                  <ThumbsDownIcon />
                  نه
                </Button>
              </>
            )}
          </div>
        </article>
        <nav aria-label="در این صفحه" className="hidden flex-col gap-2 text-sm lg:flex lg:sticky lg:top-6">
          <span className="font-semibold">در این صفحه</span>
          {TOC.map((item) => (
            <a key={item.id} href={`#${item.id}`} aria-current={activeSection === item.id ? "location" : undefined} className={`rounded-lg px-3 py-2 transition-colors ${activeSection === item.id ? "bg-primary-subtle font-semibold text-primary-subtle-foreground" : "text-muted-foreground hover:bg-subtle hover:text-foreground"}`}>
              {item.title}
            </a>
          ))}
        </nav>
      </main>
    </ControlSizeProvider>
  )
}
article-docs.vue
<script setup lang="ts">
import { onBeforeUnmount, onMounted, ref } from "vue"

import Breadcrumb from "@/components/ui/Breadcrumb.vue"
import BreadcrumbItem from "@/components/ui/BreadcrumbItem.vue"
import BreadcrumbLink from "@/components/ui/BreadcrumbLink.vue"
import BreadcrumbList from "@/components/ui/BreadcrumbList.vue"
import BreadcrumbPage from "@/components/ui/BreadcrumbPage.vue"
import BreadcrumbSeparator from "@/components/ui/BreadcrumbSeparator.vue"
import Button from "@/components/ui/Button.vue"
import ControlSize from "@/components/ui/ControlSize.vue"
import { DigIcon } from "@/lib/icons"

const TOC = [
  { id: "need", title: "پیش از شروع" },
  { id: "steps", title: "مراحلِ ساختِ فاکتور" },
  { id: "send", title: "ارسال برای مشتری" },
  { id: "faq", title: "خطاهای رایج" },
]
const NAV = ["شروعِ کار", "ساختِ فاکتور", "ارسالِ پیامکی", "گزارش‌ها", "تنظیماتِ مالیات"]
const STEPS = ["از منوی «فاکتورها» دکمهٔ «فاکتورِ تازه» را بزن.", "مشتری را انتخاب کن یا تازه بساز.", "اقلام، تعداد و تخفیف را وارد کن؛ مالیات خودش حساب می‌شود.", "«ذخیره» را بزن؛ شماره خودکار می‌گیرد."]

/**
 * مقالهٔ راهنما (مستندات): فهرستِ راهنماها در ستونِ راست با صفحهٔ فعال، متن با مسیرِ
 * صفحه و گام‌های شماره‌دار، فهرستِ مطالب در ستونِ چپ، و «این راهنما مفید بود؟» در پایان.
 */
const vote = ref<"up" | "down" | null>(null)

// بخشِ نزدیکِ یک‌سومِ بالای صفحه برای فهرستِ مطالب فعال می‌ماند (همان `useActiveSection` نسخهٔ React).
const activeSection = ref(TOC[0]?.id ?? "")
let frame = 0

function update() {
  frame = 0
  const threshold = window.innerHeight * 0.3
  let next = TOC[0]?.id ?? ""
  for (const { id } of TOC) {
    const section = document.getElementById(id)
    if (section && section.getBoundingClientRect().top <= threshold) next = id
  }
  if (activeSection.value !== next) activeSection.value = next
}

function schedule() {
  if (!frame) frame = window.requestAnimationFrame(update)
}

onMounted(() => {
  update()
  window.addEventListener("scroll", schedule, { passive: true })
  window.addEventListener("resize", schedule)
})

onBeforeUnmount(() => {
  window.removeEventListener("scroll", schedule)
  window.removeEventListener("resize", schedule)
  if (frame) window.cancelAnimationFrame(frame)
})
</script>

<template>
  <ControlSize size="xl" as-child>
    <main class="mx-auto grid w-full max-w-6xl grid-cols-1 items-start gap-10 p-4 sm:p-6 lg:grid-cols-[13rem_minmax(0,1fr)_12rem]">
      <nav aria-label="راهنماها" class="hidden flex-col gap-1 lg:flex lg:sticky lg:top-6">
        <a
          v-for="item in NAV"
          :key="item"
          href="#"
          :aria-current="item === 'ساختِ فاکتور' ? 'page' : undefined"
          :class="`rounded-lg px-3 py-2.5 text-sm ${item === 'ساختِ فاکتور' ? 'bg-primary-subtle font-semibold' : 'text-muted-foreground hover:bg-subtle hover:text-foreground'}`"
        >
          {{ item }}
        </a>
      </nav>
      <article class="flex flex-col gap-8">
        <Breadcrumb>
          <BreadcrumbList>
            <BreadcrumbItem>
              <BreadcrumbLink href="#">راهنما</BreadcrumbLink>
            </BreadcrumbItem>
            <BreadcrumbSeparator />
            <BreadcrumbItem>
              <BreadcrumbPage>ساختِ فاکتور</BreadcrumbPage>
            </BreadcrumbItem>
          </BreadcrumbList>
        </Breadcrumb>
        <!-- در موبایل ستون‌های کناری پنهان‌اند؛ راهنماهای دیگر و فهرستِ مطالب در یک بازشو. -->
        <details class="group rounded-xl border border-border bg-card lg:hidden">
          <summary class="flex min-h-12 cursor-pointer list-none items-center justify-between gap-3 px-4 text-sm font-medium [&::-webkit-details-marker]:hidden">
            فهرستِ راهنما و مطالب
            <DigIcon name="chevron-down" aria-hidden="true" class="size-4 text-muted-foreground transition-transform group-open:rotate-180" />
          </summary>
          <div class="grid grid-cols-1 gap-4 border-t border-border p-4 sm:grid-cols-2">
            <nav aria-label="راهنماها (موبایل)" class="flex flex-col gap-1">
              <span class="px-3 pb-1 text-xs font-medium text-muted-foreground">راهنماها</span>
              <a
                v-for="item in NAV"
                :key="item"
                href="#"
                :aria-current="item === 'ساختِ فاکتور' ? 'page' : undefined"
                :class="`flex min-h-11 items-center rounded-lg px-3 text-sm ${item === 'ساختِ فاکتور' ? 'bg-primary-subtle font-semibold' : 'text-muted-foreground'}`"
              >
                {{ item }}
              </a>
            </nav>
            <nav aria-label="در این صفحه (موبایل)" class="flex flex-col gap-1">
              <span class="px-3 pb-1 text-xs font-medium text-muted-foreground">در این صفحه</span>
              <a
                v-for="item in TOC"
                :key="item.id"
                :href="`#${item.id}`"
                :aria-current="activeSection === item.id ? 'location' : undefined"
                :class="`flex min-h-11 items-center rounded-lg px-3 text-sm ${activeSection === item.id ? 'bg-primary-subtle font-semibold text-primary-subtle-foreground' : 'text-muted-foreground'}`"
              >
                {{ item.title }}
              </a>
            </nav>
          </div>
        </details>
        <header class="flex flex-col gap-3">
          <h1 class="text-3xl font-bold">ساختِ اولین فاکتور</h1>
          <p class="text-lg leading-8 text-muted-foreground">در کمتر از دو دقیقه فاکتورِ رسمی بساز و برای مشتری بفرست.</p>
        </header>
        <section id="need" class="flex flex-col gap-3 scroll-mt-6">
          <h2 class="text-xl font-bold">پیش از شروع</h2>
          <p class="leading-8 text-muted-foreground">اطلاعاتِ شرکت و لوگو را در «تنظیمات ← کسب‌وکار» کامل کن تا روی فاکتور بیاید.</p>
        </section>
        <section id="steps" class="flex flex-col gap-4 scroll-mt-6">
          <h2 class="text-xl font-bold">مراحلِ ساختِ فاکتور</h2>
          <ol class="flex flex-col gap-4">
            <li v-for="(step, index) in STEPS" :key="step" class="flex gap-4">
              <span aria-hidden="true" class="flex size-8 shrink-0 items-center justify-center rounded-full bg-subtle text-sm font-bold">
                {{ "۱۲۳۴"[index] }}
              </span>
              <span class="pt-1 leading-7">{{ step }}</span>
            </li>
          </ol>
        </section>
        <section id="send" class="flex flex-col gap-3 scroll-mt-6">
          <h2 class="text-xl font-bold">ارسال برای مشتری</h2>
          <p class="leading-8 text-muted-foreground">در صفحهٔ فاکتور «ارسال» را بزن؛ مشتری پیامکی با لینکِ مشاهده و پرداخت می‌گیرد.</p>
        </section>
        <section id="faq" class="flex flex-col gap-3 rounded-xl bg-subtle p-5 scroll-mt-6">
          <h2 class="font-bold">خطاهای رایج</h2>
          <p class="text-sm leading-7 text-muted-foreground">«شمارهٔ مشتری نامعتبر است»: شماره باید با ۰۹ شروع شود و ۱۱ رقم باشد.</p>
        </section>
        <div class="flex flex-wrap items-center gap-4 border-t border-border pt-8" aria-live="polite">
          <span v-if="vote" class="text-sm">ممنون از بازخوردت!</span>
          <template v-else>
            <span class="text-sm font-medium">این راهنما مفید بود؟</span>
            <Button variant="outline" @click="vote = 'up'">
              <DigIcon name="thumbs-up" />
              بله
            </Button>
            <Button variant="outline" @click="vote = 'down'">
              <DigIcon name="thumbs-down" />
              نه
            </Button>
          </template>
        </div>
      </article>
      <nav aria-label="در این صفحه" class="hidden flex-col gap-2 text-sm lg:flex lg:sticky lg:top-6">
        <span class="font-semibold">در این صفحه</span>
        <a
          v-for="item in TOC"
          :key="item.id"
          :href="`#${item.id}`"
          :aria-current="activeSection === item.id ? 'location' : undefined"
          :class="`rounded-lg px-3 py-2 transition-colors ${activeSection === item.id ? 'bg-primary-subtle font-semibold text-primary-subtle-foreground' : 'text-muted-foreground hover:bg-subtle hover:text-foreground'}`"
        >
          {{ item.title }}
        </a>
      </nav>
    </main>
  </ControlSize>
</template>

کدِ این بلاک هنوز برای Svelte نوشته نشده است.

این موارد هنوز برای Svelte آماده نیستند: breadcrumbcontrol-sizeآیکون chevron-downآیکون thumbs-downآیکون thumbs-up

کدِ React همین بلاک مرجع است. با MCP دیگ و get_block با framework="svelte" ایجنت آن را با کامپوننت‌های Svelte می‌سازد.

article-docs.ts
import {
  ChangeDetectionStrategy,
  Component,
  DestroyRef,
  ElementRef,
  afterNextRender,
  inject,
  signal,
} from "@angular/core"

import { DigIcon } from "@/lib/icons"
import {
  DigBreadcrumb,
  DigBreadcrumbItem,
  DigBreadcrumbLink,
  DigBreadcrumbList,
  DigBreadcrumbPage,
  DigBreadcrumbSeparator,
} from "@/components/ui/breadcrumb"
import { DigButton } from "@/components/ui/button"
import { DigControlSize } from "@/components/ui/control-size"

const TOC = [
  { id: "need", title: "پیش از شروع" },
  { id: "steps", title: "مراحلِ ساختِ فاکتور" },
  { id: "send", title: "ارسال برای مشتری" },
  { id: "faq", title: "خطاهای رایج" },
]
const NAV = [
  "شروعِ کار",
  "ساختِ فاکتور",
  "ارسالِ پیامکی",
  "گزارش‌ها",
  "تنظیماتِ مالیات",
]
const STEPS = [
  "از منوی «فاکتورها» دکمهٔ «فاکتورِ تازه» را بزن.",
  "مشتری را انتخاب کن یا تازه بساز.",
  "اقلام، تعداد و تخفیف را وارد کن؛ مالیات خودش حساب می‌شود.",
  "«ذخیره» را بزن؛ شماره خودکار می‌گیرد.",
]

@Component({
  selector: "dig-block-article-docs",
  imports: [
    DigBreadcrumb,
    DigBreadcrumbItem,
    DigBreadcrumbLink,
    DigBreadcrumbList,
    DigBreadcrumbPage,
    DigBreadcrumbSeparator,
    DigButton,
    DigControlSize,
    DigIcon,
  ],
  changeDetection: ChangeDetectionStrategy.OnPush,
  template: `
    <main
      digControlSize="xl"
      class="mx-auto grid w-full max-w-6xl grid-cols-1 items-start gap-10 p-4 sm:p-6 lg:grid-cols-[13rem_minmax(0,1fr)_12rem]"
    >
      <nav
        aria-label="راهنماها"
        class="hidden flex-col gap-1 lg:flex lg:sticky lg:top-6"
      >
        @for (item of NAV; track item) {
          <a
            href="#"
            [attr.aria-current]="item === 'ساختِ فاکتور' ? 'page' : undefined"
            [class]="
              'rounded-lg px-3 py-2.5 text-sm ' +
              (item === 'ساختِ فاکتور'
                ? 'bg-primary-subtle font-semibold'
                : 'text-muted-foreground hover:bg-subtle hover:text-foreground')
            "
          >
            {{ item }}
          </a>
        }
      </nav>
      <article class="flex flex-col gap-8">
        <nav digBreadcrumb>
          <ol digBreadcrumbList>
            <li digBreadcrumbItem>
              <a digBreadcrumbLink href="#">راهنما</a>
            </li>
            <li digBreadcrumbSeparator></li>
            <li digBreadcrumbItem>
              <span digBreadcrumbPage>ساختِ فاکتور</span>
            </li>
          </ol>
        </nav>
        <!-- در موبایل ستون‌های کناری پنهان‌اند؛ راهنماهای دیگر و فهرستِ مطالب در یک بازشو. -->
        <details
          class="group rounded-xl border border-border bg-card lg:hidden"
        >
          <summary
            class="flex min-h-12 cursor-pointer list-none items-center justify-between gap-3 px-4 text-sm font-medium [&::-webkit-details-marker]:hidden"
          >
            فهرستِ راهنما و مطالب
            <svg
              digIcon="chevron-down"
              aria-hidden="true"
              class="size-4 text-muted-foreground transition-transform group-open:rotate-180"
            ></svg>
          </summary>
          <div
            class="grid grid-cols-1 gap-4 border-t border-border p-4 sm:grid-cols-2"
          >
            <nav aria-label="راهنماها (موبایل)" class="flex flex-col gap-1">
              <span class="px-3 pb-1 text-xs font-medium text-muted-foreground"
                >راهنماها</span
              >
              @for (item of NAV; track item) {
                <a
                  href="#"
                  [attr.aria-current]="
                    item === 'ساختِ فاکتور' ? 'page' : undefined
                  "
                  [class]="
                    'flex min-h-11 items-center rounded-lg px-3 text-sm ' +
                    (item === 'ساختِ فاکتور'
                      ? 'bg-primary-subtle font-semibold'
                      : 'text-muted-foreground')
                  "
                >
                  {{ item }}
                </a>
              }
            </nav>
            <nav aria-label="در این صفحه (موبایل)" class="flex flex-col gap-1">
              <span class="px-3 pb-1 text-xs font-medium text-muted-foreground"
                >در این صفحه</span
              >
              @for (item of TOC; track item.id) {
                <a
                  [href]="'#' + item.id"
                  [attr.aria-current]="
                    activeSection() === item.id ? 'location' : undefined
                  "
                  [class]="
                    'flex min-h-11 items-center rounded-lg px-3 text-sm ' +
                    (activeSection() === item.id
                      ? 'bg-primary-subtle font-semibold text-primary-subtle-foreground'
                      : 'text-muted-foreground')
                  "
                >
                  {{ item.title }}
                </a>
              }
            </nav>
          </div>
        </details>
        <header class="flex flex-col gap-3">
          <h1 class="text-3xl font-bold">ساختِ اولین فاکتور</h1>
          <p class="text-lg leading-8 text-muted-foreground">
            در کمتر از دو دقیقه فاکتورِ رسمی بساز و برای مشتری بفرست.
          </p>
        </header>
        <section id="need" class="flex flex-col gap-3 scroll-mt-6">
          <h2 class="text-xl font-bold">پیش از شروع</h2>
          <p class="leading-8 text-muted-foreground">
            اطلاعاتِ شرکت و لوگو را در «تنظیمات ← کسب‌وکار» کامل کن تا روی
            فاکتور بیاید.
          </p>
        </section>
        <section id="steps" class="flex flex-col gap-4 scroll-mt-6">
          <h2 class="text-xl font-bold">مراحلِ ساختِ فاکتور</h2>
          <ol class="flex flex-col gap-4">
            @for (step of STEPS; track step; let index = $index) {
              <li class="flex gap-4">
                <span
                  aria-hidden="true"
                  class="flex size-8 shrink-0 items-center justify-center rounded-full bg-subtle text-sm font-bold"
                >
                  {{ "۱۲۳۴"[index] }}
                </span>
                <span class="pt-1 leading-7">{{ step }}</span>
              </li>
            }
          </ol>
        </section>
        <section id="send" class="flex flex-col gap-3 scroll-mt-6">
          <h2 class="text-xl font-bold">ارسال برای مشتری</h2>
          <p class="leading-8 text-muted-foreground">
            در صفحهٔ فاکتور «ارسال» را بزن؛ مشتری پیامکی با لینکِ مشاهده و
            پرداخت می‌گیرد.
          </p>
        </section>
        <section
          id="faq"
          class="flex flex-col gap-3 rounded-xl bg-subtle p-5 scroll-mt-6"
        >
          <h2 class="font-bold">خطاهای رایج</h2>
          <p class="text-sm leading-7 text-muted-foreground">
            «شمارهٔ مشتری نامعتبر است»: شماره باید با ۰۹ شروع شود و ۱۱ رقم باشد.
          </p>
        </section>
        <div
          class="flex flex-wrap items-center gap-4 border-t border-border pt-8"
          aria-live="polite"
        >
          @if (vote()) {
            <span class="text-sm">ممنون از بازخوردت!</span>
          } @else {
            <span class="text-sm font-medium">این راهنما مفید بود؟</span>
            <button
              digButton
              type="button"
              variant="outline"
              (click)="vote.set('up')"
            >
              <svg digIcon="thumbs-up"></svg>
              بله
            </button>
            <button
              digButton
              type="button"
              variant="outline"
              (click)="vote.set('down')"
            >
              <svg digIcon="thumbs-down"></svg>
              نه
            </button>
          }
        </div>
      </article>
      <nav
        aria-label="در این صفحه"
        class="hidden flex-col gap-2 text-sm lg:flex lg:sticky lg:top-6"
      >
        <span class="font-semibold">در این صفحه</span>
        @for (item of TOC; track item.id) {
          <a
            [href]="'#' + item.id"
            [attr.aria-current]="
              activeSection() === item.id ? 'location' : undefined
            "
            [class]="
              'rounded-lg px-3 py-2 transition-colors ' +
              (activeSection() === item.id
                ? 'bg-primary-subtle font-semibold text-primary-subtle-foreground'
                : 'text-muted-foreground hover:bg-subtle hover:text-foreground')
            "
          >
            {{ item.title }}
          </a>
        }
      </nav>
    </main>
  `,
})
export class ArticleDocsBlock {
  readonly TOC = TOC
  readonly NAV = NAV
  readonly STEPS = STEPS

  readonly vote = signal<"up" | "down" | null>(null)

  readonly activeSection = signal(TOC[0]?.id ?? "")

  constructor() {
    const host = inject<ElementRef<HTMLElement>>(ElementRef).nativeElement
    const destroyRef = inject(DestroyRef)
    afterNextRender(() => {
      const sections = TOC.map(({ id }) => ({
        id,
        element: host.querySelector<HTMLElement>("#" + id),
      }))
      let frame = 0
      const update = () => {
        frame = 0
        const threshold = window.innerHeight * 0.3
        let next = TOC[0]?.id ?? ""
        for (const { id, element } of sections) {
          if (element && element.getBoundingClientRect().top <= threshold)
            next = id
        }
        this.activeSection.set(next)
      }
      const schedule = () => {
        if (!frame) frame = window.requestAnimationFrame(update)
      }
      update()
      window.addEventListener("scroll", schedule, { passive: true })
      window.addEventListener("resize", schedule)
      destroyRef.onDestroy(() => {
        window.removeEventListener("scroll", schedule)
        window.removeEventListener("resize", schedule)
        if (frame) window.cancelAnimationFrame(frame)
      })
    })
  }
}

کدِ این بلاک هنوز برای Android نوشته نشده است.

همهٔ کامپوننت‌های لازم برای Android آماده‌اند؛ با MCP می‌توانید همین صفحه را از روی نسخهٔ React بسازید.

کدِ React همین بلاک مرجع است. با MCP دیگ و get_block با framework="android" ایجنت آن را با کامپوننت‌های Android می‌سازد.