Skip to content

Commit

Permalink
fix: locale direction (#385)
Browse files Browse the repository at this point in the history
  • Loading branch information
R894 authored Jan 11, 2024
1 parent cbb3a7f commit ee93af2
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!DOCTYPE html>
<html lang="he" dir="rtl">
<html lang="he">
<head>
<meta charset="utf-8" />
<link rel="icon" href="favicon.ico" />
Expand Down
5 changes: 4 additions & 1 deletion src/layout/ThemeContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import React, { FC, PropsWithChildren, createContext, useContext, useState } fro
import { ThemeProvider as MuiThemeProvider, createTheme } from '@mui/material/styles'
import { ConfigProvider, theme } from 'antd'
import heIL from 'antd/es/locale/he_IL'
import { useTranslation } from 'react-i18next'

export interface ThemeContextInterface {
toggleTheme: () => void
isDarkTheme: boolean
Expand All @@ -23,6 +25,7 @@ const lightTheme = createTheme({
const { defaultAlgorithm, darkAlgorithm } = theme
export const ThemeProvider: FC<PropsWithChildren> = ({ children }) => {
const [isDarkTheme, setIsDarkTheme] = useState(false)
const { i18n } = useTranslation()

const toggleTheme = () => {
setIsDarkTheme((prevTheme) => !prevTheme)
Expand All @@ -35,7 +38,7 @@ export const ThemeProvider: FC<PropsWithChildren> = ({ children }) => {

return (
<ConfigProvider
direction="rtl"
direction={i18n.dir()}
locale={heIL}
theme={{
algorithm: isDarkTheme ? darkAlgorithm : defaultAlgorithm,
Expand Down

0 comments on commit ee93af2

Please sign in to comment.