From 65a0c5dff9c97ba29cb512b19ce1eec38addef2a Mon Sep 17 00:00:00 2001 From: Thomas Zemp Date: Mon, 12 Feb 2024 12:01:49 +0100 Subject: [PATCH] fix: right align table elements in rtl --- components/table/src/table/table-cell-head.js | 4 + components/table/src/table/table-cell.js | 4 + components/table/src/table/table.stories.js | 128 ++++++++++++++++++ 3 files changed, 136 insertions(+) diff --git a/components/table/src/table/table-cell-head.js b/components/table/src/table/table-cell-head.js index 5450cbeb1a..3dd0986875 100644 --- a/components/table/src/table/table-cell-head.js +++ b/components/table/src/table/table-cell-head.js @@ -12,6 +12,10 @@ const tableCellHeadStyles = css` height: 45px; } + th:dir(rtl) { + text-align: right; + } + .dense { padding: 9px 12px; height: 36px; diff --git a/components/table/src/table/table-cell.js b/components/table/src/table/table-cell.js index d54fe0867e..8de551e205 100644 --- a/components/table/src/table/table-cell.js +++ b/components/table/src/table/table-cell.js @@ -12,6 +12,10 @@ const tableCellStyles = css` height: 45px; } + td:dir(rtl) { + text-align: right; + } + .dense { padding: 9px 12px; height: 36px; diff --git a/components/table/src/table/table.stories.js b/components/table/src/table/table.stories.js index f81f1039cc..ae529d91a0 100644 --- a/components/table/src/table/table.stories.js +++ b/components/table/src/table/table.stories.js @@ -594,3 +594,131 @@ export const CustomAlternatingBgColor = () => ( ) + +export const RTL = (args) => ( +
+ + + + First name + Last name + Incident date + Last updated + Age + Registering unit + Assigned user + Status + + + + + Onyekachukwu + Kariuki + 02/06/2007 + 05/25/1972 + 66 + Jawi + Sofie Hubert + Incomplete + + + Kwasi + Okafor + 08/11/2010 + 02/26/1991 + 38 + Mokassie MCHP + Dashonte Clarke + Complete + + + Siyabonga + Abiodun + 07/21/1981 + 02/06/2007 + 98 + Bathurst MCHP + Unassigned + Incomplete + + + Chiyembekezo + Okeke + 01/23/1982 + 07/15/2003 + 2 + Mayolla MCHP + Wan Gengxin + Incomplete + + + Mtendere + Afolayan + 08/12/1994 + 05/12/1972 + 37 + Gbangadu MCHP + Gvozden Boskovsky + Complete + + + Inyene + Okonkwo + 04/01/1971 + 03/16/2000 + 70 + Kunike Barina + Oscar de la Cavallería + Complete + + + Amaka + Pretorius + 01/25/1996 + 09/15/1986 + 32 + Bargbo + Alberto Raya + Incomplete + + + Meti + Abiodun + 10/24/2010 + 07/26/1989 + 8 + Majihun MCHP + Unassigned + Complete + + + Eshe + Okeke + 01/31/1995 + 01/31/1995 + 63 + Mambiama CHP + Shadrias Pearson + Incomplete + + + Obi + Okafor + 06/07/1990 + 01/03/2006 + 28 + Dalakuru CHP + Anatoliy Shcherbatykh + Incomplete + + + + + + + + + +
+
+)