Skip to content

Commit

Permalink
font state change for reference - test
Browse files Browse the repository at this point in the history
  • Loading branch information
sijumoncy committed May 29, 2024
1 parent 481c2a7 commit f8853e6
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@ import PropTypes from 'prop-types';

const AudioWaveform = dynamic(() => import('./WaveForm'), { ssr: false });

export default function ReferenceSelector({ data, versepath, verse }) {
export default function ReferenceSelector({
data, versepath, verse, font, fontSize,
}) {
const path = require('path');
return (
<div className="bg-white col-span-3 m-3 rounded-md shadow overflow-hidden">
Expand All @@ -21,7 +23,14 @@ export default function ReferenceSelector({ data, versepath, verse }) {
{story.verseNumber}
</div>
</div>
<p className="text-sm text-gray-600 leading-relaxed">
<p
className="text-sm text-gray-600 leading-relaxed"
style={{
fontFamily: font || 'sans-serif',
fontSize: `${fontSize}rem`,
lineHeight: (fontSize > 1.3) ? 1.5 : '',
}}
>
{story.verseText}
</p>
</div>
Expand Down
5 changes: 3 additions & 2 deletions renderer/src/components/EditorPage/ObsEditor/ReferenceObs.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ const style = {
fontStyle: 'italic',
},
};
const ReferenceObs = ({ stories, font, title }) => {
const ReferenceObs = ({
stories, font, title, fontSize,
}) => {
const [isLoading, setIsLoading] = useState(true);
const [direction, setDirection] = useState('ltr');
const [networkState, setNetworkState] = useState({ online: true });
const {
state: {
selectedStory,
fontSize,
},
actions: {
setSelectedStory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const ReferenceObs = ({ stories }) => {
state: {
selectedStory,
selectedFont,
fontSize,
fontSize1: fontSize,
},
actions: {
setSelectedStory,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const ReferenceCard = ({
font,
setResetTrigger,
resetTrigger,
fontSize,
}) => {
const {
state: {
Expand Down Expand Up @@ -43,7 +44,12 @@ const ReferenceCard = ({
setItemIndex={setItemIndex}
/>
)}
<div style={{ fontFamily: font || 'sans-serif' }}>
<div style={{
fontFamily: font || 'sans-serif',
fontSize: `${fontSize}rem`,
lineHeight: (fontSize > 1.3) ? 1.5 : '',
}}
>
<CardContent
item={item}
items={items}
Expand Down
13 changes: 12 additions & 1 deletion renderer/src/components/EditorPage/Reference/TranslationHelps.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import ObsTnCard from './OBS/ObsTn';
import ObsTwlCard from './OBS/ObsTwlCard';

const TranslationHelps = ({
selectedResource, languageId, refName, bookId, chapter, verse, owner, story, offlineResource, font,
selectedResource, languageId, refName, bookId, chapter, verse, owner, story, offlineResource, font, fontSize,
}) => {
const {
state: {
Expand Down Expand Up @@ -40,6 +40,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
case 'twl':
Expand All @@ -56,6 +57,7 @@ const TranslationHelps = ({
owner="test_org"
server="https://git.door43.org"
font={font}
fontSize={fontSize}
/>
);
case 'twlm':
Expand All @@ -72,6 +74,7 @@ const TranslationHelps = ({
owner={owner}
server="https://git.door43.org"
font={font}
fontSize={fontSize}
/>
);
case 'tq':
Expand All @@ -90,6 +93,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
case 'tw':
Expand All @@ -106,6 +110,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
case 'ta':
Expand All @@ -123,6 +128,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
case 'bible':
Expand All @@ -135,6 +141,7 @@ const TranslationHelps = ({
chapter={chapter}
verse={verse}
font={font}
fontSize={fontSize}
/>
);
case 'obs':
Expand All @@ -147,6 +154,7 @@ const TranslationHelps = ({
chapter={chapter}
verse={verse}
font={font}
fontSize={fontSize}
/>
);
case 'obs-tn':
Expand All @@ -163,6 +171,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
case 'obs-tq':
Expand All @@ -179,6 +188,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
case 'obs-twlm':
Expand All @@ -195,6 +205,7 @@ const TranslationHelps = ({
server="https://git.door43.org"
offlineResource={offlineResource}
font={font}
fontSize={fontSize}
/>
);
default:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export default function TranslationHelpsCard({
viewMode,
offlineResource,
font,
fontSize,
}) {
const [offlineItems, setOfflineItems] = useState([]);
const [offlineItemsDisable, setOfflineItemsDisable] = useState(false);
Expand Down Expand Up @@ -271,6 +272,7 @@ export default function TranslationHelpsCard({
selectedQuote={selectedQuote}
setQuote={setQuote}
font={font}
fontSize={fontSize}
setResetTrigger={setResetTrigger}
resetTrigger={resetTrigger}
/>
Expand Down
18 changes: 15 additions & 3 deletions renderer/src/components/context/ReferenceContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ export default function ReferenceContextProvider({ children }) {
const [font2, setFont2] = useState('sans-serif');
const [font3, setFont3] = useState('sans-serif');
const [font4, setFont4] = useState('sans-serif');
const [fontSize, setFontsize] = React.useState(1);
const [editorFontSize, setEditorFontSize] = React.useState(1);
const [fontSize1, setFontsize1] = React.useState(1);
const [fontSize2, setFontsize2] = React.useState(1);
const [fontSize3, setFontsize3] = React.useState(1);
const [fontSize4, setFontsize4] = React.useState(1);
const [layout, setLayout] = useState(0);
const [row, setRow] = useState(0);
const [refernceLoading, setRefernceLoading] = useState({
Expand Down Expand Up @@ -196,7 +200,11 @@ export default function ReferenceContextProvider({ children }) {
font2,
font3,
font4,
fontSize,
fontSize1,
fontSize2,
fontSize3,
fontSize4,
editorFontSize,
layout,
row,
refernceLoading,
Expand Down Expand Up @@ -244,7 +252,11 @@ export default function ReferenceContextProvider({ children }) {
setFont2,
setFont3,
setFont4,
setFontsize,
setEditorFontSize,
setFontsize1,
setFontsize2,
setFontsize3,
setFontsize4,
setLayout,
setRow,
setRefernceLoading,
Expand Down

0 comments on commit f8853e6

Please sign in to comment.