Merge branch 'main' into production
This commit is contained in:
commit
c212acf98f
6 changed files with 71 additions and 8 deletions
|
@ -56,6 +56,7 @@ body .root .content.theme {
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
|
flex-wrap: unset;
|
||||||
a {
|
a {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
@ -66,6 +67,11 @@ body .root .content.theme {
|
||||||
padding: 0 0 0 7px;
|
padding: 0 0 0 7px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
input {
|
||||||
|
padding: 10px;
|
||||||
|
border-radius: 10px;
|
||||||
|
border: 1px solid #000;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -94,6 +100,7 @@ body .root .content.theme.ar {
|
||||||
}
|
}
|
||||||
|
|
||||||
footer {
|
footer {
|
||||||
|
flex-direction: unset;
|
||||||
font-family: "Mada Regular";
|
font-family: "Mada Regular";
|
||||||
a span {
|
a span {
|
||||||
padding: 0 7px 0 0;
|
padding: 0 7px 0 0;
|
||||||
|
|
|
@ -29,6 +29,12 @@
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
input {
|
||||||
|
border: 1px solid $primary-color;
|
||||||
|
&:focus {
|
||||||
|
outline-color: $primary-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,13 +14,21 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
footer a {
|
footer {
|
||||||
&:active, &:link, &:visited {
|
a {
|
||||||
color: $green1;
|
&:active, &:link, &:visited {
|
||||||
text-decoration: none;
|
color: $green1;
|
||||||
|
text-decoration: none;
|
||||||
|
}
|
||||||
|
&:hover {
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
&:hover {
|
input {
|
||||||
font-weight: bold;
|
border: 1px solid $green1;
|
||||||
|
&:focus {
|
||||||
|
outline-color: $green1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
"surah": "Surah",
|
"surah": "Surah",
|
||||||
"ayah": "Ayah",
|
"ayah": "Ayah",
|
||||||
"comma": ",",
|
"comma": ",",
|
||||||
|
"filter": "Filter",
|
||||||
"meta": {
|
"meta": {
|
||||||
"index": {"description": "Explore the chapters of The Noble Quran. Browse a list of chapters and choose a chapter you can read and listen to. Enhance your understanding of a sacred text."},
|
"index": {"description": "Explore the chapters of The Noble Quran. Browse a list of chapters and choose a chapter you can read and listen to. Enhance your understanding of a sacred text."},
|
||||||
"stream": {"description": "Experience The Noble Quran. Read and listen to a single chapter with a verse streamed at regular intervals. Immerse yourself in a sacred text in a unique way."}
|
"stream": {"description": "Experience The Noble Quran. Read and listen to a single chapter with a verse streamed at regular intervals. Immerse yourself in a sacred text in a unique way."}
|
||||||
|
@ -134,6 +135,7 @@
|
||||||
"surah": "سورة",
|
"surah": "سورة",
|
||||||
"ayah": "آية",
|
"ayah": "آية",
|
||||||
"comma": "،",
|
"comma": "،",
|
||||||
|
"filter": "تصفية",
|
||||||
"meta": {
|
"meta": {
|
||||||
"index": {
|
"index": {
|
||||||
"description": "استكشف فصول القرآن الكريم. تصفح قائمة بالفصول واختر فصلاً يمكنك قراءته والاستماع إليه. قم بتعزيز فهمك لنص مقدس."
|
"description": "استكشف فصول القرآن الكريم. تصفح قائمة بالفصول واختر فصلاً يمكنك قراءته والاستماع إليه. قم بتعزيز فهمك لنص مقدس."
|
||||||
|
|
32
src/js/components/SurahIndexFilter.tsx
Normal file
32
src/js/components/SurahIndexFilter.tsx
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
import React from "react";
|
||||||
|
import { TFunction } from "lib/i18n";
|
||||||
|
import * as Quran from "lib/Quran";
|
||||||
|
|
||||||
|
type Props = {
|
||||||
|
t: TFunction;
|
||||||
|
locale: Quran.Locale;
|
||||||
|
setIndex: (k: Quran.Surah[]) => void;
|
||||||
|
surahs: Quran.Surah[];
|
||||||
|
};
|
||||||
|
|
||||||
|
export function SurahIndexFilter({ t, locale, setIndex, surahs }: Props) {
|
||||||
|
const onInput = (e: React.ChangeEvent<HTMLInputElement>) => {
|
||||||
|
const {
|
||||||
|
target: { value },
|
||||||
|
} = e;
|
||||||
|
if (value === "") {
|
||||||
|
setIndex(surahs);
|
||||||
|
} else {
|
||||||
|
const regexp = new RegExp(value, "i");
|
||||||
|
const newIndex = surahs.filter(
|
||||||
|
surah =>
|
||||||
|
regexp.test(surah.localizedName) || regexp.test(String(surah.id)),
|
||||||
|
);
|
||||||
|
setIndex(newIndex);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<input type="text" placeholder={t(locale, "filter")} onChange={onInput} />
|
||||||
|
);
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useRef, useEffect } from "react";
|
import React, { useRef, useState, useEffect } from "react";
|
||||||
import ReactDOM from "react-dom/client";
|
import ReactDOM from "react-dom/client";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
|
||||||
|
@ -8,6 +8,7 @@ import { ThemeSelect } from "components/ThemeSelect";
|
||||||
import { LanguageSelect } from "components/LanguageSelect";
|
import { LanguageSelect } from "components/LanguageSelect";
|
||||||
import { i18n, formatNumber, TFunction } from "lib/i18n";
|
import { i18n, formatNumber, TFunction } from "lib/i18n";
|
||||||
import { RightArrow } from "components/Icon";
|
import { RightArrow } from "components/Icon";
|
||||||
|
import { SurahIndexFilter } from "components/SurahIndexFilter";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
locale: Quran.Locale;
|
locale: Quran.Locale;
|
||||||
|
@ -17,6 +18,7 @@ interface Props {
|
||||||
|
|
||||||
function SurahIndex({ locale, surahs, t }: Props) {
|
function SurahIndex({ locale, surahs, t }: Props) {
|
||||||
const [theme, setTheme] = useTheme();
|
const [theme, setTheme] = useTheme();
|
||||||
|
const [index, setIndex] = useState<Quran.Surah[]>(surahs);
|
||||||
const ref = useRef<HTMLDivElement>();
|
const ref = useRef<HTMLDivElement>();
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
@ -41,7 +43,7 @@ function SurahIndex({ locale, surahs, t }: Props) {
|
||||||
</nav>
|
</nav>
|
||||||
</header>
|
</header>
|
||||||
<ul className="body index scroll-y">
|
<ul className="body index scroll-y">
|
||||||
{surahs.map((surah, key) => (
|
{index.map((surah, key) => (
|
||||||
<li className="surah" key={key}>
|
<li className="surah" key={key}>
|
||||||
<a href={`/${locale}/${surah.slug}/`}>
|
<a href={`/${locale}/${surah.slug}/`}>
|
||||||
<span className="id">{formatNumber(surah.id, locale)}</span>
|
<span className="id">{formatNumber(surah.id, locale)}</span>
|
||||||
|
@ -58,6 +60,12 @@ function SurahIndex({ locale, surahs, t }: Props) {
|
||||||
<RightArrow />
|
<RightArrow />
|
||||||
<span>{t(locale, "ChooseRandomChapter")}</span>
|
<span>{t(locale, "ChooseRandomChapter")}</span>
|
||||||
</a>
|
</a>
|
||||||
|
<SurahIndexFilter
|
||||||
|
t={t}
|
||||||
|
locale={locale}
|
||||||
|
surahs={surahs}
|
||||||
|
setIndex={setIndex}
|
||||||
|
/>
|
||||||
</footer>
|
</footer>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue