المكوّنات · بطاقة عقار
بطاقة عقار
سعر المتر محسوب من السعر والمساحة
12 تصاميم من هذه العائلة
<div class="cd cdr"><article class="card">
<div class="img"><span class="tag" data-ar="جديد" data-en="New">جديد</span></div>
<div class="body">
<h5 data-ar="فيلا دورين · حيّ الياسمين" data-en="Two-storey villa · Al-Yasmin">فيلا دورين · حيّ الياسمين</h5>
<div class="price num"></div>
<div class="ppm"><span data-ar="سعر المتر" data-en="Per m²">سعر المتر</span><b class="num"></b></div>
<ul class="specs">
<li><span class="k num"></span><span data-ar="غرف" data-en="Beds">غرف</span></li>
<li><span class="k num"></span><span data-ar="حمّامات" data-en="Baths">حمّامات</span></li>
<li><span class="k num"></span><span data-ar="م²" data-en="m²">م²</span></li>
</ul>
</div>
</article></div>
/* pt-scoped */
/* card-property — منصّة عقارية */
.cdr{width:100%;height:100%;display:flex;align-items:center;justify-content:center;
padding:8px;font-size:10px;color:var(--pt-text-secondary);overflow:hidden}
.cdr .card{display:flex;overflow:hidden;background:var(--pt-surface);
border:1px solid var(--pt-border-subtle)}
.cdr h5{margin:0;font-size:11px;color:var(--pt-text-primary);font-weight:600;line-height:1.4}
.cdr p{margin:0;font-size:8.5px;color:var(--pt-text-muted);line-height:1.7}
.cdr .num{font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.cdr .img{flex:none;position:relative;overflow:hidden}
.cdr button{font:inherit;cursor:pointer}
.cdr button:focus-visible{outline:2px solid var(--pt-focus-ring);outline-offset:1px}
.cdr .bar{height:3px;border-radius:99px;background:var(--pt-border-subtle);overflow:hidden}
.cdr .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){.cdr .bar i{transition:none}
}
/* شكل: عمودية بغطاء واسع، انحناء كبير، مواصفات ثلاثية */
.cdr .card{flex-direction:column;width:196px;border-radius:var(--pt-radius-xl)}
.cdr .img{height:70px;background:linear-gradient(120deg,#2f5d52,#4e8a6b 50%,#9dc48f)}
.cdr .tag{position:absolute;inset-block-start:6px;inset-inline-end:6px;padding:2px 7px;
border-radius:var(--pt-radius-full);background:rgba(255,255,255,.92);color:#123;
font-size:7.5px;font-weight:700}
.cdr .body{display:flex;flex-direction:column;gap:5px;padding:9px 10px 10px}
.cdr .price{font-size:14px;color:var(--pt-accent);font-weight:700}
.cdr .ppm{display:flex;align-items:baseline;justify-content:space-between;gap:8px;
padding:4px 7px;border-radius:var(--pt-radius-md);background:var(--pt-bg-inset);font-size:8px}
.cdr .ppm b{color:var(--pt-text-primary);font-size:9px}
.cdr .specs{list-style:none;margin:0;padding:6px 0 0;display:flex;gap:12px;
border-top:1px solid var(--pt-border-subtle);font-size:8px;color:var(--pt-text-muted)}
.cdr .specs li{display:flex;align-items:baseline;gap:3px}
.cdr .specs .k{color:var(--pt-text-primary);font-weight:700;font-size:10px}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.cdr');
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 PRICE = 480000, AREA = 420, BEDS = 5, BATHS = 4; /* بالدولار */
set('.price', money(PRICE));
// سعر المتر = السعر ÷ المساحة — الرقم الذي يقارن به المشتري فعلًا
set('.ppm b', money(PRICE / AREA));
var ks = root.querySelectorAll('.specs .k');
[BEDS, BATHS, AREA].forEach(function (v, i) { ks[i].textContent = n(v); });
}
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(); });
})();
# Property 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:** Property Card — Price per square metre derived from price and area
**Why this component matters:** Price per m² is the number buyers actually compare on. Compute it from price ÷ area instead of storing it, so the two can never drift apart.
**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.