From 574d4032c1bb50bc0abc9089fd5fa9705e5749b4 Mon Sep 17 00:00:00 2001 From: Arian Rahimi Date: Sun, 25 Aug 2019 13:37:57 +0430 Subject: [PATCH] feat: add direction to the redoc styled component this feature let users to set direction and it's officially start point of RTL --- src/components/Redoc/styled.elements.tsx | 3 ++- src/theme.ts | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/components/Redoc/styled.elements.tsx b/src/components/Redoc/styled.elements.tsx index ebb30df1..adb18d16 100644 --- a/src/components/Redoc/styled.elements.tsx +++ b/src/components/Redoc/styled.elements.tsx @@ -10,6 +10,7 @@ export const RedocWrap = styled.div` display: flex; position: relative; text-align: left; + direction: ${theme.typography.direction}; -webkit-font-smoothing: ${theme.typography.smoothing}; font-smoothing: ${theme.typography.smoothing}; @@ -42,7 +43,7 @@ export const BackgroundStub = styled.div` position: absolute; top: 0; bottom: 0; - right: 0; + ${({ theme }) => theme.typography.direction === 'ltr' ? 'right: 0;' : 'left: 0;'}; width: ${({ theme }) => { if (theme.rightPanel.width.endsWith('%')) { const percents = parseInt(theme.rightPanel.width, 10); diff --git a/src/theme.ts b/src/theme.ts index 9b274097..a6dd205b 100644 --- a/src/theme.ts +++ b/src/theme.ts @@ -273,6 +273,8 @@ export interface ResolvedThemeInterface { fontWeightBold: string; fontFamily: string; + direction?: 'ltr' | 'rtl', + smoothing: string; optimizeSpeed: boolean;