المكوّنات · بطاقة تذكرة برمز
بطاقة تذكرة برمز
شقّ جانبي ورمز شريطي مرسوم، والعدّ التنازلي من التاريخ
9 تصاميم من هذه العائلة
<div class="ap apck"><div class="ph">
<div class="sb"><span class="tm num"></span>
<span class="r" aria-hidden="true"><span>▲</span><span>◗</span><span class="bt num"></span></span></div>
<div class="scr"><div class="body">
<article class="tk">
<div class="top"><span class="cat" data-ar="حفل موسيقي" data-en="Concert">حفل موسيقي</span>
<b data-ar="ليلة الطرب الأصيل" data-en="Classic Tarab Night">ليلة الطرب الأصيل</b>
<span class="ven" data-ar="مسرح الملك فهد · الرياض" data-en="King Fahd Theatre · Riyadh">مسرح الملك فهد · الرياض</span></div>
<div class="grid"><div><i data-ar="التاريخ" data-en="Date">التاريخ</i><b class="dt num"></b></div>
<div><i data-ar="الوقت" data-en="Time">الوقت</i><b class="tm3 num">20:30</b></div>
<div><i data-ar="المقعد" data-en="Seat" >المقعد</i><b class="num">C-14</b></div></div>
<div class="notch" aria-hidden="true"></div>
<div class="bar"><svg class="bc" viewBox="0 0 120 26" preserveAspectRatio="none"
aria-hidden="true"></svg><span class="cd num"></span></div>
<div class="cdn num"></div>
</article>
</div></div>
<div class="safe"></div>
</div></div>
/* pt-scoped */
/* appcard-ticket — حجز فعاليات */
.apck{width:100%;height:100%;display:flex;align-items:center;
justify-content:center;padding:6px;font-size:10px;color:var(--pt-text-secondary);
overflow:hidden}
.apck .ph{position:relative;width:198px;height:100%;max-height:224px;display:flex;
flex-direction:column;overflow:hidden;background:var(--pt-bg-base);
border:1px solid var(--pt-border-default);border-radius:20px;
box-shadow:var(--pt-shadow-3)}
/* شريط الحالة — ليس تزيينًا: يثبت أعلى الشاشة فلا يبدأ المحتوى عند الحافّة */
.apck .sb{flex:none;display:flex;align-items:center;justify-content:space-between;
padding:5px 12px 2px;font-size:7px;color:var(--pt-text-muted);
font-variant-numeric:tabular-nums}
.apck .sb .r{display:flex;gap:3px}
.apck .scr{flex:1;min-height:0;display:flex;flex-direction:column;overflow:hidden}
.apck .body{flex:1;min-height:0;overflow-y:auto;overflow-x:hidden;
-webkit-overflow-scrolling:touch}
.apck .body::-webkit-scrollbar{width:0}
/* المنطقة الآمنة السفلية — شريط الإيماءات يأكل ما تحته */
.apck .safe{flex:none;height:9px;display:grid;place-items:center}
.apck .safe::after{content:'';width:52px;height:3px;border-radius:99px;
background:var(--pt-border-strong)}
.apck h6{margin:0;font-size:10px;color:var(--pt-text-primary);font-weight:600;line-height:1.4}
.apck p{margin:0;font-size:8px;color:var(--pt-text-muted);line-height:1.65}
.apck .num{font-variant-numeric:tabular-nums}
.apck button{font:inherit;cursor:pointer;
transition:background var(--pt-motion-duration-fast) var(--pt-motion-easing-standard),
color var(--pt-motion-duration-fast) var(--pt-motion-easing-standard),
transform var(--pt-motion-duration-fast) var(--pt-motion-easing-standard)}
.apck button:focus-visible, .apck a:focus-visible, .apck input:focus-visible{
outline:2px solid var(--pt-focus-ring);outline-offset:-1px}
/* هدف اللمس: 44 بكسلًا على الشاشات اللمسية، ومساحة نقر ممتدّة على غيرها */
@media(pointer:coarse){.apck .tap{min-width:44px;min-height:44px}
}
.apck .tap{position:relative}
.apck .tap::before{content:'';position:absolute;inset:-6px}
@media(prefers-reduced-motion:reduce){.apck *{transition:none!important;animation:none!important}
}
.apck .body{padding:9px 12px;display:flex;align-items:center}
.apck .tk{position:relative;width:100%;display:flex;flex-direction:column;gap:8px;
padding:11px;border-radius:14px;background:var(--pt-surface);
border:1px solid var(--pt-border-subtle)}
.apck .cat{font-size:6.5px;padding:2px 7px;border-radius:99px;background:var(--pt-accent-muted);
color:var(--pt-accent);align-self:flex-start;font-weight:700}
.apck .top{display:flex;flex-direction:column;gap:3px}
.apck .top b{font-size:11px;color:var(--pt-text-primary)}
.apck .ven{font-size:7.5px;color:var(--pt-text-muted)}
.apck .grid{display:grid;grid-template-columns:repeat(3,1fr);gap:6px}
.apck .grid i{display:block;font-style:normal;font-size:6.5px;color:var(--pt-text-muted)}
.apck .grid b{font-size:9px;color:var(--pt-text-primary);font-variant-numeric:tabular-nums}
.apck .notch{border-top:1px dashed var(--pt-border-strong);margin:0 -11px;position:relative}
.apck .notch::before, .apck .notch::after{content:'';position:absolute;inset-block-start:-6px;
width:12px;height:12px;border-radius:50%;background:var(--pt-bg-base)}
.apck .notch::before{inset-inline-start:-6px}
.apck .notch::after{inset-inline-end:-6px}
.apck .bar{display:flex;flex-direction:column;align-items:center;gap:3px}
.apck .bc{width:100%;height:26px}
.apck .cd{font-family:var(--pt-font-mono);font-size:7.5px;color:var(--pt-text-muted);
letter-spacing:.14em}
.apck .cdn{text-align:center;font-size:8px;color:var(--pt-accent);font-weight:700}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.apck');
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 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 * 3.75, d) + ' ر.س' : '$' + n(usd, d);
};
var set = function (sel, txt) {
var el = root.querySelector(sel); if (el) el.textContent = txt; return el;
};
/* الساعة بأرقام لاتينية دائمًا — قرار موحّد في المشروع كلّه */
(function clock() {
var t = root.querySelector('.tm');
if (!t) return;
function tick() {
var d = new Date();
t.textContent = String(d.getHours()).padStart(2, '0') + ':' +
String(d.getMinutes()).padStart(2, '0');
setTimeout(tick, 20000);
}
tick();
})();
var bt = root.querySelector('.bt');
if (bt) bt.textContent = '84%';
/* اهتزاز خفيف حيث يوجد — تأكيد لمسيّ لا يعتمد عليه شيء */
var buzz = function (ms) { try { if (navigator.vibrate) navigator.vibrate(ms || 8); } catch (e) {} };
var CODE = 'PT4821TRB09';
var when = new Date(); when.setDate(when.getDate() + 5); when.setHours(20, 30, 0, 0);
set('.dt', when.toLocaleDateString(ar ? 'ar-SA-u-nu-latn' : 'en-GB',
{ day: 'numeric', month: 'short' }));
set('.cd', CODE);
/* الأعمدة مولَّدة من الرمز نفسه: رمز مرسوم بيد ينفصل عن الرقم المكتوب تحته */
var bc = root.querySelector('.bc'), x = 0, out = '';
for (var i = 0; i < CODE.length; i++) {
var c = CODE.charCodeAt(i);
for (var b = 0; b < 4; b++) {
var w = ((c >> b) & 1) ? 2.2 : 1;
if ((c >> (b + 4)) & 1) {
out += '<rect x="' + x.toFixed(2) + '" y="0" width="' + w.toFixed(2) +
'" height="26" fill="var(--pt-text-primary)"></rect>';
}
x += w + 0.6;
}
}
bc.setAttribute('viewBox', '0 0 ' + Math.max(120, x) + ' 26');
bc.innerHTML = out;
// العدّ من التاريخ لا بطرح متتابع ينحرف
var cdn = root.querySelector('.cdn');
(function tick() {
var left = Math.max(0, when - Date.now());
var d = Math.floor(left / 864e5), h = Math.floor(left / 36e5) % 24, m = Math.floor(left / 6e4) % 60;
cdn.textContent = ar ? 'يبدأ بعد ' + d + ' أيّام و' + h + ' ساعة و' + m + ' دقيقة'
: 'Starts in ' + d + 'd ' + h + 'h ' + m + 'm';
setTimeout(tick, 30000);
})();
}
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(); });
})();
# Ticket Card with Code
**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:** Ticket Card with Code — Side notches, a generated barcode, and a countdown from the event date
**Why this component matters:** Generate the barcode bars from the ticket code so the two cannot diverge, and count down from a target date instead of decrementing a number that drifts.
**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.