Skip to content

feat: add styles for RTL #525

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions kit/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -264,21 +264,25 @@

.prose code {
@apply font-normal;
direction: ltr;
}

.prose code,
.prose strong {
@apply text-gray-800;
direction: ltr;
}

.prose .course-tip code,
.prose .course-tip a {
@apply text-green-800 dark:text-green-600;
direction: ltr;
}

.prose .course-tip.course-tip-orange code,
.prose .course-tip.course-tip-orange a {
@apply text-orange-800 dark:text-orange-600;
direction: ltr;
}

.prose .course-tip ul {
Expand All @@ -303,10 +307,12 @@

.prose.prose-doc .code-block {
@apply -mx-3 text-smd md:mx-0 md:text-base;
direction: ltr;
}

.prose.prose-doc .code-block pre {
@apply border border-gray-100;
direction: ltr;
}

.prose.prose-doc > p > em {
Expand Down Expand Up @@ -406,3 +412,7 @@
.prose.prose-course p {
@apply md:mb-8;
}

.direction-rtl {
direction: rtl;
}
9 changes: 6 additions & 3 deletions kit/src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
import { base } from "$app/paths";
import type { RawChapter } from "./endpoints/toc/+server";
import "../app.css";

export const DOCS_LANGUAGE = "${process.env.DOCS_LANGUAGE}";
export let data;
export let toc: RawChapter[] = data.toc ?? [];
export const DOCS_DIRECTION = (DOCS_LANGUAGE == "ar") ? "rtl" : "ltr" ;
</script>

{#if !import.meta.env.DEV}
<slot />
<div class="direction-{DOCS_DIRECTION}">
<slot />
</div>
{:else}
<style>
body,
Expand All @@ -19,7 +22,7 @@
}
</style>
<div
class="flex"
class="flex direction-{DOCS_DIRECTION}"
>
<div class="w-[270px] 2xl:w-[300px] hidden md:block border-r-2 shrink-0">
<ul class="pt-2 flex flex-col pl-3 w-full">
Expand Down
3 changes: 3 additions & 0 deletions kit/tailwind.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,9 @@ module.exports = {
1: "1",
"-1": "-1",
},
direction: {
rtl: "rtl",
},
},
},
plugins: [
Expand Down