Skip to content
This repository has been archived by the owner on Mar 14, 2023. It is now read-only.

Pro542/nextjs-temp-rtl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Temporary nextjs repo for testing RTL using styled-jsx

This is an URL based approach on switching locale/language with nextjs.

The main concern here is applying the required RTL CSS when needed. Along with right-aligining the text; borders, padding, margins and other styles should also be changed as needed to display the content correctly.

The approach is summarized as follows:

  1. Use a custom server and routes to accomodate localhost:3000/en/<route> and localhost:3000/ar/<route>.
  2. Pass the locale key from the requested URL to components to determine the direction.
  3. Set the dir attribute for html accordingly.
  4. Use CSS selectors in the format:global(html[dir=rtl]) .someClass to apply required styles.

Use npm run dev to start the development server locally

About

temp repo to tinker with rtl css in nextjs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published