المكوّنات · بطاقة طلب بخطّ زمني
بطاقة طلب بخطّ زمني
التقدّم محسوب من المرحلة الحالية بين المراحل
12 تصاميم من هذه العائلة
<div class="cd cdo"><article class="card">
<div class="hd"><span class="no num">#48210</span>
<span class="eta num"></span></div>
<h5 data-ar="مطعم بيت الشاورما" data-en="Shawarma House">مطعم بيت الشاورما</h5>
<div class="track">
<div class="rail"><i></i></div>
<ol class="steps"></ol>
</div>
<div class="ft"><span class="items num"></span><b class="tot num"></b></div>
</article></div>
/* pt-scoped */
/* card-order — تطبيق توصيل */
.cdo{width:100%;height:100%;display:flex;align-items:center;justify-content:center;
padding:8px;font-size:10px;color:var(--pt-text-secondary);overflow:hidden}
.cdo .card{display:flex;overflow:hidden;background:var(--pt-surface);
border:1px solid var(--pt-border-subtle)}
.cdo h5{margin:0;font-size:11px;color:var(--pt-text-primary);font-weight:600;line-height:1.4}
.cdo p{margin:0;font-size:8.5px;color:var(--pt-text-muted);line-height:1.7}
.cdo .num{font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.cdo .img{flex:none;position:relative;overflow:hidden}
.cdo button{font:inherit;cursor:pointer}
.cdo button:focus-visible{outline:2px solid var(--pt-focus-ring);outline-offset:1px}
.cdo .bar{height:3px;border-radius:99px;background:var(--pt-border-subtle);overflow:hidden}
.cdo .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){.cdo .bar i{transition:none}
}
/* شكل: عمودية بخطّ زمني أفقي، انحناء ٢×كبير */
.cdo .card{flex-direction:column;width:222px;gap:8px;padding:10px;
border-radius:var(--pt-radius-2xl);background:var(--pt-bg-inset)}
.cdo .hd{display:flex;align-items:baseline;justify-content:space-between;gap:8px;font-size:8px}
.cdo .no{color:var(--pt-text-muted);font-family:var(--pt-font-mono)}
.cdo .eta{color:var(--pt-accent);font-weight:700}
.cdo .track{position:relative;padding-top:3px}
.cdo .rail{height:2px;border-radius:99px;background:var(--pt-border-subtle);
margin:0 9px 5px;overflow:hidden}
.cdo .rail i{display:block;height:100%;width:0;background:var(--pt-accent);
transition:width var(--pt-motion-duration-slow) var(--pt-motion-easing-standard)}
.cdo .steps{list-style:none;margin:0;padding:0;display:flex;justify-content:space-between}
.cdo .steps li{flex:1;display:flex;flex-direction:column;align-items:center;gap:3px;
font-size:7px;color:var(--pt-text-muted);text-align:center}
.cdo .steps li::before{content:'';width:7px;height:7px;border-radius:50%;
background:var(--pt-border-subtle);order:-1;margin-top:-9px}
.cdo .steps li.on{color:var(--pt-accent)}
.cdo .steps li.on::before{background:var(--pt-accent)}
.cdo .steps li.now::before{box-shadow:0 0 0 3px color-mix(in srgb,var(--pt-accent) 28%,transparent)}
.cdo .ft{display:flex;align-items:baseline;justify-content:space-between;gap:8px;
padding-top:6px;border-top:1px solid var(--pt-border-subtle);font-size:8.5px}
.cdo .items{color:var(--pt-text-muted)}
.cdo .tot{color:var(--pt-text-primary);font-size:11px;font-weight:700}
@media(prefers-reduced-motion:reduce){.cdo .rail i{transition:none}
}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.cdo');
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 STEPS = [
{ ar: 'تم الاستلام', en: 'Received' }, { ar: 'قيد التحضير', en: 'Preparing' },
{ ar: 'في الطريق', en: 'On the way' }, { ar: 'وصل', en: 'Delivered' }
];
var AT = 2, ETA = 14, ITEMS = 4, TOTAL = 23.6;
var ol = root.querySelector('.steps');
ol.innerHTML = STEPS.map(function (s, i) {
return '<li class="' + (i <= AT ? 'on' : '') + (i === AT ? ' now' : '') + '">' +
(ar ? s.ar : s.en) + '</li>';
}).join('');
// المرحلة الأولى مبلوغة أصلًا — فالقسمة على العدد ناقصًا واحدًا لا على العدد
var pct = AT / (STEPS.length - 1) * 100;
requestAnimationFrame(function () { root.querySelector('.rail i').style.width = pct + '%'; });
set('.eta', ar ? 'يصل خلال ' + ETA + ' دقيقة' : ETA + ' min away');
set('.items', ITEMS + (ar ? ' أصناف' : ' items'));
set('.tot', money(TOTAL, 2));
}
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(); });
})();
# Order Card with Timeline
**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:** Order Card with Timeline — Progress derived from the current stage within the stage list
**Why this component matters:** A four-stage tracker is not 25/50/75/100: the first stage is already reached, so the fill is index ÷ (count − 1). Getting this wrong makes a fresh order look a quarter done.
**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.