المكوّنات · قسم آراء العملاء
قسم آراء العملاء
يتنقّل تلقائيًّا، ويتوقّف بالتمرير وبالتركيز
12 تصاميم من هذه العائلة
<div class="bk bkt"><section>
<span class="eyebrow" data-ar="آراء" data-en="REVIEWS">آراء</span>
<div class="stage" role="group" aria-roledescription="carousel" aria-label="آراء العملاء" tabindex="0">
<blockquote class="slide"><p class="q"></p>
<footer><span class="av" aria-hidden="true"></span>
<span class="who"><b class="nm"></b><span class="rl"></span></span>
<span class="stars" aria-hidden="true"></span></footer></blockquote>
</div>
<div class="dots" role="tablist" aria-label="اختر رأيًا"></div>
</section></div>
/* pt-scoped */
/* block-testimonials — متجر إلكتروني */
.bkt{width:100%;height:100%;display:flex;flex-direction:column;
font-size:10px;color:var(--pt-text-secondary);overflow:hidden}
.bkt h2{margin:0;font-size:19px;line-height:1.35;color:var(--pt-text-primary);
font-weight:700;letter-spacing:-.01em}
.bkt h3{margin:0;font-size:12px;line-height:1.4;color:var(--pt-text-primary);font-weight:600}
.bkt h4{margin:0;font-size:10px;color:var(--pt-text-primary);font-weight:600}
.bkt p{margin:0;font-size:9.5px;line-height:1.85;color:var(--pt-text-muted)}
.bkt .eyebrow{font-size:8px;letter-spacing:.14em;color:var(--pt-accent);font-weight:700}
.bkt .num{font-variant-numeric:tabular-nums;letter-spacing:-.01em}
.bkt button, .bkt a{font:inherit;cursor:pointer;text-decoration:none}
.bkt button:focus-visible, .bkt a:focus-visible, .bkt input:focus-visible, .bkt summary:focus-visible{outline:2px solid var(--pt-focus-ring);outline-offset:2px}
/* الأقسام تمتدّ من حافّة إلى حافّة — هذا ما يميّزها عن المكوّنات */
.bkt > section{flex:1;display:flex;flex-direction:column;justify-content:center;min-height:0}
@media(pointer:coarse){.bkt button, .bkt a{min-height:44px;display:inline-flex;
align-items:center;justify-content:center}
}
/* شخصية: اقتباس متمركز، نقاط تحكّم، انحناء كبير */
.bkt > section{align-items:center;gap:9px;padding:14px 34px;background:var(--pt-surface)}
.bkt .stage{width:100%;max-width:430px;border-radius:var(--pt-radius-xl);
background:var(--pt-bg-inset);padding:12px 15px;outline-offset:3px}
.bkt .slide{margin:0;display:flex;flex-direction:column;gap:9px;
animation:bkfade var(--pt-motion-duration-normal) var(--pt-motion-easing-standard)}
@keyframes bkfade{from{opacity:0;transform:translateY(4px)}to{opacity:1;transform:none}}
@media(prefers-reduced-motion:reduce){.bkt .slide{animation:none}
}
.bkt .q{font-size:10px;line-height:1.9;color:var(--pt-text-primary);min-height:38px}
.bkt .q::before{content:'\201D';color:var(--pt-accent);font-size:17px;
margin-inline-end:3px;line-height:0;vertical-align:-3px}
.bkt footer{display:flex;align-items:center;gap:7px}
.bkt .av{width:24px;height:24px;border-radius:50%;flex:none;display:grid;place-items:center;
font-size:10px;font-weight:700;color:var(--pt-color-ink-900)}
.bkt .who{flex:1;display:flex;flex-direction:column;min-width:0}
.bkt .nm{font-size:9px;color:var(--pt-text-primary)}
.bkt .rl{font-size:7.5px;color:var(--pt-text-muted)}
.bkt .stars{color:var(--pt-accent);font-size:9px;letter-spacing:1px}
.bkt .dots{display:flex;gap:5px}
.bkt .dots button{width:6px;height:6px;padding:0;border:0;border-radius:50%;
background:var(--pt-border-strong);
transition:width var(--pt-motion-duration-fast) var(--pt-motion-easing-standard),
background var(--pt-motion-duration-fast) var(--pt-motion-easing-standard)}
.bkt .dots button[aria-selected=true]{width:16px;border-radius:99px;background:var(--pt-accent)}
@media(prefers-reduced-motion:reduce){.bkt .dots button{transition:none}
}
/* يعمل داخل إطار معزول — لا يعتمد على شيء خارجه */
/* pt-remount — يعاد التركيب عند تبديل اللغة */
(function () {
var host = document.querySelector('.bkt');
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 ITEMS = [
{ q: { ar: 'ركّبنا المتجر في أسبوع بدل شهر، والواجهة العربية لم تحتج تعديلًا واحدًا.',
en: 'Store shipped in a week instead of a month, and the Arabic UI needed no fixes.' },
n: { ar: 'ريم الشمري', en: 'Reem Al-Shammari' },
r: { ar: 'مديرة منتج · متجر أثاث', en: 'Product lead · Furniture store' }, s: 5, h: 262 },
{ q: { ar: 'أوّل مرّة أجد مكتبة تفهم أنّ الرقم يبقى إنجليزيًّا والنصّ عربيًّا.',
en: 'First library that understands numerals stay Latin while the text is Arabic.' },
n: { ar: 'فهد العتيبي', en: 'Fahd Al-Otaibi' },
r: { ar: 'مطوّر واجهات', en: 'Frontend developer' }, s: 5, h: 188 },
{ q: { ar: 'البرومبتات وفّرت علينا أيّامًا — نلصقها في الأداة فتخرج النتيجة قريبة جدًّا.',
en: 'The prompts saved us days — paste them in and the output lands very close.' },
n: { ar: 'دانة الحمد', en: 'Dana Al-Hamad' },
r: { ar: 'مؤسِّسة · تطبيق توصيل', en: 'Founder · Delivery app' }, s: 4, h: 32 }
];
var i = 0, timer = null, DELAY = 4200;
var stage = root.querySelector('.stage');
var q = root.querySelector('.q'), nm = root.querySelector('.nm');
var rl = root.querySelector('.rl'), av = root.querySelector('.av');
var st = root.querySelector('.stars'), dots = root.querySelector('.dots');
dots.innerHTML = ITEMS.map(function (_, k) {
return '<button role="tab" aria-selected="' + (k === 0) + '" aria-label="' + (k + 1) + '"></button>';
}).join('');
var btns = [].slice.call(dots.children);
function show(k) {
i = (k + ITEMS.length) % ITEMS.length;
var t = ITEMS[i];
q.textContent = ar ? t.q.ar : t.q.en;
nm.textContent = ar ? t.n.ar : t.n.en;
rl.textContent = ar ? t.r.ar : t.r.en;
av.textContent = (ar ? t.n.ar : t.n.en).charAt(0);
av.style.background = 'hsl(' + t.h + ' 58% 66%)';
st.textContent = '★'.repeat(t.s) + '☆'.repeat(5 - t.s);
btns.forEach(function (b, k2) { b.setAttribute('aria-selected', String(k2 === i)); });
/* إعادة تشغيل الظهور: إزالة الصنف ثم إعادته لا تكفي بلا إجبار إعادة التدفّق */
var s = root.querySelector('.slide');
s.style.animation = 'none'; void s.offsetWidth; s.style.animation = '';
}
function play() { stop(); timer = setInterval(function () { show(i + 1); }, DELAY); }
function stop() { if (timer) { clearInterval(timer); timer = null; } }
/* التوقّف عند التمرير وعند التركيز معًا: من يقرأ ببطء أو بلوحة المفاتيح
يفقد النصّ إن استمرّ الدوران. */
stage.addEventListener('mouseenter', stop);
stage.addEventListener('mouseleave', play);
stage.addEventListener('focusin', stop);
stage.addEventListener('focusout', play);
stage.addEventListener('keydown', function (e) {
if (e.key !== 'ArrowRight' && e.key !== 'ArrowLeft') return;
e.preventDefault();
var rtl = getComputedStyle(root).direction === 'rtl';
var fwd = rtl ? e.key === 'ArrowLeft' : e.key === 'ArrowRight';
show(i + (fwd ? 1 : -1));
});
dots.addEventListener('click', function (e) {
var b = e.target.closest('button');
if (b) { show(btns.indexOf(b)); play(); }
});
show(0);
if (!matchMedia('(prefers-reduced-motion: reduce)').matches) play();
}
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(); });
})();
# Testimonials Carousel
**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:** Testimonials Carousel — Auto-advances, and pauses on hover and on focus
**Why this component matters:** An auto-rotating carousel must pause on hover AND on keyboard focus, and expose arrow-key navigation — otherwise it steals content away from anyone reading slowly.
**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.