المكوّنات · بطاقة موظّف
بطاقة موظّف
مدّة الخدمة محسوبة من تاريخ التعيين
12 تصاميم من هذه العائلة
<div class="cd cdu"><article class="card">
<div class="av" aria-hidden="true">ن</div>
<div class="body">
<h5 data-ar="نورة العتيبي" data-en="Noura Al-Otaibi">نورة العتيبي</h5>
<p data-ar="مديرة تطوير الأعمال · الرياض" data-en="Business Development Lead · Riyadh">مديرة تطوير الأعمال · الرياض</p>
<div class="chips"><span class="on"><i aria-hidden="true"></i><span data-ar="متاحة" data-en="Available">متاحة</span></span>
<span class="ten num"></span></div>
</div>
<button class="msg" data-ar="مراسلة" data-en="Message">مراسلة</button>
</article></div>
/* pt-scoped */
/* card-profile — موارد بشرية */
.cdu{width:100%;height:100%;display:flex;align-items:center;justify-content:center;
padding:8px;font-size:10px;color:var(--pt-text-secondary);overflow:hidden}
.cdu .card{display:flex;overflow:hidden;background:var(--pt-surface);
border:1px solid var(--pt-border-subtle)}
.cdu h5{margin:0;font-size:11px;color:var(--pt-text-primary);font-weight:600;line-height:1.4}
.cdu p{margin:0;font-size:8.5px;color:var(--pt-text-muted);line-height:1.7}
.cdu .num{font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.cdu .img{flex:none;position:relative;overflow:hidden}
.cdu button{font:inherit;cursor:pointer}
.cdu button:focus-visible{outline:2px solid var(--pt-focus-ring);outline-offset:1px}
.cdu .bar{height:3px;border-radius:99px;background:var(--pt-border-subtle);overflow:hidden}
.cdu .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){.cdu .bar i{transition:none}
}
/* شكل: أفقية بصورة دائرية، انحناء كامل للبطاقة نفسها */
.cdu .card{flex-direction:row;align-items:center;gap:9px;width:236px;padding:8px 10px 8px 8px;
border-radius:var(--pt-radius-full)}
.cdu .av{flex:none;width:34px;height:34px;border-radius:50%;display:grid;place-items:center;
font-size:14px;font-weight:700;color:var(--pt-color-ink-900);
background:linear-gradient(135deg,var(--pt-accent),color-mix(in srgb,var(--pt-accent) 55%,#fff))}
.cdu .body{flex:1;min-width:0;display:flex;flex-direction:column;gap:2px}
.cdu h5{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cdu p{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.cdu .chips{display:flex;align-items:center;gap:6px;font-size:7.5px}
.cdu .on{display:flex;align-items:center;gap:3px;color:var(--pt-accent)}
.cdu .on i{width:5px;height:5px;border-radius:50%;background:var(--pt-accent)}
.cdu .ten{color:var(--pt-text-muted)}
.cdu .msg{flex:none;padding:5px 11px;border-radius:var(--pt-radius-full);
border:1px solid var(--pt-border-default);background:transparent;
color:var(--pt-text-secondary);font-size:8.5px}
.cdu .msg:hover{border-color:var(--pt-accent);color:var(--pt-accent)}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.cdu');
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 HIRED = '2021-03-14'; /* المخزَّن هو التاريخ لا المدّة */
var h = new Date(HIRED), now = new Date();
var months = (now.getFullYear() - h.getFullYear()) * 12 + (now.getMonth() - h.getMonth());
if (now.getDate() < h.getDate()) months--;
var y = Math.floor(months / 12), m = months % 12;
set('.ten', ar ? 'في الخدمة ' + y + ' سنة' + (m ? ' و' + m + ' شهرًا' : '')
: y + 'y ' + m + 'm tenure');
}
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(); });
})();
# Employee Card
**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:** Employee Card — Tenure computed from the hire date
**Why this component matters:** Store the hire date and derive tenure at render time; a stored “3 years” silently becomes wrong the moment the page is cached.
**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.