المكوّنات · بطاقة طبيب بمواعيد
بطاقة طبيب بمواعيد
نسبة الحجز والمواعيد المتاحة محسوبة من الجدول
12 تصاميم من هذه العائلة
<div class="cd cdl"><article class="card">
<div class="hd"><span class="av" aria-hidden="true">د</span>
<div><h5 data-ar="د. سارة المطيري" data-en="Dr. Sarah Al-Mutairi">د. سارة المطيري</h5>
<p data-ar="طبّ الأسرة · عيادة النخيل" data-en="Family medicine · Al-Nakheel">طبّ الأسرة · عيادة النخيل</p></div>
<span class="fee num"></span></div>
<div class="slots"><span class="lbl num"></span>
<div class="grid"></div></div>
<button class="book" disabled></button>
</article></div>
/* pt-scoped */
/* card-clinic — عيادة طبّية */
.cdl{width:100%;height:100%;display:flex;align-items:center;justify-content:center;
padding:8px;font-size:10px;color:var(--pt-text-secondary);overflow:hidden}
.cdl .card{display:flex;overflow:hidden;background:var(--pt-surface);
border:1px solid var(--pt-border-subtle)}
.cdl h5{margin:0;font-size:11px;color:var(--pt-text-primary);font-weight:600;line-height:1.4}
.cdl p{margin:0;font-size:8.5px;color:var(--pt-text-muted);line-height:1.7}
.cdl .num{font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.cdl .img{flex:none;position:relative;overflow:hidden}
.cdl button{font:inherit;cursor:pointer}
.cdl button:focus-visible{outline:2px solid var(--pt-focus-ring);outline-offset:1px}
.cdl .bar{height:3px;border-radius:99px;background:var(--pt-border-subtle);overflow:hidden}
.cdl .bar i{display:block;height:100%;background:var(--pt-accent);border-radius:inherit;
transition:width var(--pt-motion-duration-slow) var(--pt-motion-easing-standard)}
@media(prefers-reduced-motion:reduce){.cdl .bar i{transition:none}
}
/* شكل: عمودية بشبكة مواعيد، انحناء كبير، خلفية سطح */
.cdl .card{flex-direction:column;width:224px;gap:8px;padding:10px;
border-radius:var(--pt-radius-lg)}
.cdl .hd{display:flex;align-items:flex-start;gap:8px}
.cdl .av{flex:none;width:30px;height:30px;border-radius:var(--pt-radius-md);display:grid;
place-items:center;background:var(--pt-accent-muted);color:var(--pt-accent);
font-size:13px;font-weight:700}
.cdl .hd > div{flex:1;min-width:0}
.cdl .fee{font-size:9.5px;color:var(--pt-accent);font-weight:700;white-space:nowrap}
.cdl .slots{display:flex;flex-direction:column;gap:5px}
.cdl .lbl{font-size:8px;color:var(--pt-text-muted)}
.cdl .grid{display:grid;grid-template-columns:repeat(4,1fr);gap:4px}
.cdl .grid button{padding:5px 0;border-radius:var(--pt-radius-sm);
border:1px solid var(--pt-border-default);background:var(--pt-bg-inset);
color:var(--pt-text-secondary);font-size:8px;font-variant-numeric:tabular-nums}
.cdl .grid button:hover:not(:disabled){border-color:var(--pt-accent);color:var(--pt-accent)}
.cdl .grid button:disabled{opacity:.34;cursor:not-allowed;text-decoration:line-through}
.cdl .grid button[aria-pressed=true]{background:var(--pt-accent);border-color:var(--pt-accent);
color:var(--pt-color-ink-900);font-weight:700}
.cdl .book{padding:7px;border-radius:var(--pt-radius-md);border:0;background:var(--pt-accent);
color:var(--pt-color-ink-900);font-size:9.5px;font-weight:600}
.cdl .book:disabled{opacity:.4;cursor:not-allowed}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.cdl');
if (!host) return;
var snapshot = host.innerHTML;
var timers = [];
var ac = null;
/* الجسم كما كتبه المولِّد. يستقبل بدائل مظلَّلة لـ root وdocument
والمؤقّتات، فينظّف نفسه دون أن يعرف أنه قابل لإعادة التركيب. */
function run(root, document, setTimeout, setInterval) {
var ar = document.documentElement.lang !== 'en';
var PEG = 3.75; /* الريال مربوط بالدولار */
var n = function (v, d) { return Number(v).toLocaleString('en-US', {
minimumFractionDigits: d || 0, maximumFractionDigits: d || 0 }); };
/* العملة: ر.س بعد الرقم عربيًّا، $ قبله إنجليزيًّا */
var money = function (usd, d) {
return ar ? n(usd * PEG, d) + ' ر.س' : '$' + n(usd, d);
};
var set = function (sel, txt) {
var el = root.querySelector(sel); if (el) el.textContent = txt; return el;
};
var FEE = 48;
/* المحجوز يُعطَّل ولا يُخفى: صباح ممتلئ ظاهر يوجّه المريض للمساء،
وقائمة فارغة تبدو كأنّها فشل تحميل. */
var SLOTS = [
{ t: '09:00', taken: true }, { t: '09:30', taken: true }, { t: '10:00', taken: false },
{ t: '10:30', taken: true }, { t: '11:00', taken: false }, { t: '11:30', taken: false },
{ t: '16:00', taken: true }, { t: '16:30', taken: false }
];
var open = SLOTS.filter(function (s) { return !s.taken; }).length;
set('.fee', money(FEE));
set('.lbl', ar ? open + ' موعدًا متاحًا من ' + SLOTS.length
: open + ' of ' + SLOTS.length + ' slots open');
var grid = root.querySelector('.grid');
grid.innerHTML = SLOTS.map(function (s) {
return '<button type="button" aria-pressed="false"' + (s.taken ? ' disabled' : '') +
'>' + s.t + '</button>';
}).join('');
var book = root.querySelector('.book');
book.textContent = ar ? 'اختر موعدًا' : 'Pick a time';
grid.addEventListener('click', function (e) {
var b = e.target.closest('button');
if (!b || b.disabled) return;
grid.querySelectorAll('button').forEach(function (x) {
x.setAttribute('aria-pressed', String(x === b));
});
book.disabled = false;
book.textContent = (ar ? 'احجز ' : 'Book ') + b.textContent;
});
}
function mount() {
ac = new AbortController();
var real = window.document;
/* وسيط يمرّر كل شيء إلى المستند الحقيقي، ويعلّق كل مستمع بإشارة
تُقطع عند إعادة التركيب — فلا يبقى مستمع من نسخة ماتت. */
var doc = new Proxy(real, {
get: function (t, k) {
if (k === 'addEventListener') {
return function (type, fn, opts) {
var o = (opts && typeof opts === 'object') ? Object.assign({}, opts)
: { capture: !!opts };
o.signal = ac.signal;
return t.addEventListener(type, fn, o);
};
}
var v = t[k];
return typeof v === 'function' ? v.bind(t) : v;
}
});
function track(fn) {
return function (f, ms) { var id = fn(f, ms); timers.push(id); return id; };
}
run(host, doc, track(window.setTimeout.bind(window)),
track(window.setInterval.bind(window)));
}
function unmount() {
if (ac) ac.abort();
// المعرّفان يتشاركان فضاءً واحدًا في المتصفّح، فالإلغاء المزدوج آمن
timers.forEach(function (id) { window.clearTimeout(id); window.clearInterval(id); });
timers = [];
host.innerHTML = snapshot;
}
mount();
addEventListener('pt-lang', function () { unmount(); mount(); });
})();
# Doctor Card with Slots
**Role:** You are an Arabic-first UI designer and front-end engineer. Read the whole
specification before writing a single line, then follow it literally. If two requirements
conflict, favour usability over visual effect.
**Goal:** Doctor Card with Slots — Booked ratio and open slots computed from the schedule
**Why this component matters:** Disable taken slots rather than hiding them: a visibly full morning tells the patient to look at the afternoon, while an empty list looks like a loading failure.
**Direction:** Genuine RTL — not a mirrored Latin layout. Use logical properties
(`margin-inline-start`, `padding-inline`, `inset-inline-start`, `text-align: start`),
never physical ones (`margin-left`, `left`). The layout must flip with `dir` on its own,
with no duplicated rules.
**Typography:** Cairo for Arabic, IBM Plex Sans for Latin. Arabic line-height must be
`0.18` higher than the Latin equivalent — dots, hamzas and maddas need more vertical room.
Arabic font-size runs `1.06×` the Latin size at the same optical weight.
**Numerals:** Western digits in both languages (`1,234.50`). Only the currency changes:
`ر.س` **after** the number in Arabic, `$` **before** it in English. Jordanian dinar
uses **three** decimal places, not two.
**Colors:** Dark mode — background `#0D142B` · surfaces `#211F54` · borders `#545C91` · text `#918FC2`.
Accent `#ADA9E8` must never exceed 8% of the screen area.
**Language:** Bilingual — every string carries both Arabic and English, and the layout
flips with `dir` automatically.
**States:** `default` · `hover` · `focus` · `active` · `disabled` · `loading` · `error`.
Do not design the resting state alone.
**Accessibility:** Contrast ratio at least `4.5:1`, complete keyboard navigation,
visible focus rings, and honour `prefers-reduced-motion`.
**Output:** Clean HTML and CSS in two separate files. No frameworks, no libraries,
no external dependencies.