ข้ามไปยังเนื้อหา

จุดสถานะ

StatusDot

A small coloured dot with text beside it, for a live state such as a service being available. The text carries the meaning, so it's never the dot alone. For a record's status, use Badge.

ใช้แสดงสถานะที่เปลี่ยนตามเวลา เช่น ระบบเชื่อมต่อพร้อมใช้งานหรือไม่ ข้อความบอกความหมายเสมอ ไม่ใช้สีอย่างเดียว ถ้าเป็นสถานะของเอกสาร ใช้ Badge

import { StatusDot } from "@bsru/ui";

ตัวอย่าง

ทุกสี

good เป็นสีเขียว warning สีทอง bad สีแดง และ neutral สีเทา

พร้อมใช้งานช้ากว่าปกติไม่พร้อมปิดปรับปรุง
<StatusDot tone="good" label="พร้อมใช้งาน" />
<StatusDot tone="warning" label="ช้ากว่าปกติ" />
<StatusDot tone="bad" label="ไม่พร้อม" />
<StatusDot tone="neutral" label="ปิดปรับปรุง" />

props ทั้งหมด

ตัวอย่างด้านบนใช้ props เพียงบางตัว ตารางนี้แสดงทุกตัวที่คอมโพเนนต์รับ พร้อมค่าเริ่มต้นและค่าที่ใช้ได้

StatusDot props
ชื่อชนิดข้อมูลค่าเริ่มต้นคำอธิบาย
tone* จำเป็นkeyof typeof DOT_TONES
ค่าที่ใช้ได้:"warning""good""bad""neutral"
—good is green, bad red, warning gold and neutral grey.
label* จำเป็นstring—The state in words, already in the screen language, such as พร้อมใช้งาน.

ข้อควรปฏิบัติ

  • จุดซ่อนจากโปรแกรมอ่านหน้าจอ ข้อความคือสิ่งที่อ่าน

ซอร์สโค้ด: ui/src/marks.tsx