diff --git a/static/css/s2.css b/static/css/s2.css index 2e79cf920d..88b2dc96c0 100644 --- a/static/css/s2.css +++ b/static/css/s2.css @@ -5937,32 +5937,31 @@ body .ui-autocomplete.dictionary-toc-autocomplete .ui-menu-item a.ui-state-focus font-style: normal; } + .rightButtons { display: flex; white-space: nowrap; flex-direction: row; text-align: left; } -.interface-english .leftButtons, -.interface-hebrew .rightButtons { +.rightButtons { display: flex; flex-direction: row; text-align: left; } -.interface-english .rightButtons, -.interface-hebrew .leftButtons { +.leftButtons { display: flex; flex-direction: row; text-align: left; } /* icons need a little nudge in flipped hebrew mode */ -.interface-hebrew .rightButtons { +.rightButtons { margin-left: -3px; } -.interface-hebrew .leftButtons { +.leftButtons { margin-right: 2px; } @@ -5987,7 +5986,7 @@ body .ui-autocomplete.dictionary-toc-autocomplete .ui-menu-item a.ui-state-focus left: -50px; } -.interface-hebrew .rightButtons .saveButton.tooltip-toggle::before { +.rightButtons .saveButton.tooltip-toggle::before { left: auto; right: -50px; } @@ -15606,6 +15605,201 @@ span.ref-link-color-3 { color: #666666; } +.dropdownMenu { + position: relative; + display: flex; + flex-direction: row-reverse; + z-index: 3; + } + + .dropdownButton { + border: none; + background-color: inherit; + } + + .rightButtons .dropdownButton { + text-align: end; + } + .dropdownLinks-menu { + display: contents; + } + + .dropdownLinks-menu.closed { + display: none; + } + + .texts-properties-menu { + width: 256px; + border: 1px solid var(--lighter-grey); + border-radius: 5px; + box-shadow: 0px 2px 4px var(--lighter-grey); + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + position: absolute; + top: 100%; + background-color: white; + --english-font: var(--english-sans-serif-font-family); + --hebrew-font: var(--hebrew-sans-serif-font-family); + } + .texts-properties-menu, + .texts-properties-menu .button { + font-size: 14px; + } + + .show-source-translation-buttons { + display: flex; + flex-direction: column; + height: 140px; + justify-content: center; + } + + .show-source-translation-buttons .button { + margin: unset; + display: flex; + height: 35px; + width: 235px; + align-items: center; + justify-content: space-between; + box-shadow: unset; + padding-inline-start: 10px; + padding-inline-end: 0; + } + + .show-source-translation-buttons .button:has(input:not(:checked)) { + background-color: var(--lighter-grey); + color: black; + } + + .show-source-translation-buttons input[type=radio] { + appearance: none; + background-color: #fff; + width: 20px; + height: 20px; + border: 2px solid var(--medium-grey); + border-radius: 20px; + margin-top: 0; + margin-inline-end: 10px; + display: inline-grid; + place-content: center; + } + + .show-source-translation-buttons input[type=radio]:checked { + border: 0; + } + + .show-source-translation-buttons input[type=radio], + .show-source-translation-buttons label { + cursor: unset; + } + + .show-source-translation-buttons > div:first-of-type { + border-radius: 6px 6px 0 0; + } + + .show-source-translation-buttons > div:last-of-type { + border-radius: 0 0 6px 6px; + } + + .show-source-translation-buttons > div:not(:first-of-type):not(:last-of-type) { + border-radius: 0; + } + + .show-source-translation-buttons input[type=radio]:checked::before { + content: ""; + width: 10px; + height: 10px; + background-color: var(--sefaria-blue); + clip-path: polygon(13% 50%, 34% 66%, 81% 2%, 100% 18%, 39% 100%, 0 71%); + } + + .text-menu-border { + width: 100%; + height: 1px; + background-color: var(--lighter-grey); + + } + + .layout-button-line { + height: 57px; + width: 216px; + display: flex; + justify-content: space-between; + align-items: center; + } + + .layout-options { + display: flex; + justify-content: space-between; + align-items: center; + gap: 16px; + } + + .font-size-line { + width: 230px; + height: 50px; + display: flex; + justify-content: space-between; + align-items: center; + direction: ltr; + } + + .font-size-button { + display: flex; + align-items: center; + background-color: white; + border: none; + cursor: pointer; + } + + .layout-button-line { + height: 57px; + width: 216px; + display: flex; + justify-content: space-between; + align-items: center; + } + + .layout-options { + display: flex; + justify-content: space-between; + align-items: center; + gap: 16px; + } + + .layout-button input { + border: none; + width: 28px; + height: 24px; + -webkit-mask: var(--url) no-repeat; + -webkit-mask-size: contain; + -webkit-mask-repeat: no-repeat; + -webkit-mask-position: center; + -webkit-mask-size: 100% 100%; + background-color: var(--medium-grey); + cursor: pointer; + appearance: unset; + transition: border 0.3s ease, outline 0.3s ease, background-color 0.3s ease; + } + + .layout-button input:checked { + background-color: var(--sefaria-blue); + } + + .layout-button .button { + background-color: unset; + box-shadow: unset; + padding: unset; + margin: unset; + } + + + + + + + @-webkit-keyframes load5 { 0%, 100% { box-shadow: 0 -2.6em 0 0 #ffffff, 1.8em -1.8em 0 0 rgba(0, 0, 0, 0.2), 2.5em 0 0 0 rgba(0, 0, 0, 0.2), 1.75em 1.75em 0 0 rgba(0, 0, 0, 0.2), 0 2.5em 0 0 rgba(0, 0, 0, 0.2), -1.8em 1.8em 0 0 rgba(0, 0, 0, 0.2), -2.6em 0 0 0 rgba(0, 0, 0, 0.5), -1.8em -1.8em 0 0 rgba(0, 0, 0, 0.7) diff --git a/static/icons/bi-ltr-heLeft.svg b/static/icons/bi-ltr-heLeft.svg new file mode 100644 index 0000000000..2d28ee586f --- /dev/null +++ b/static/icons/bi-ltr-heLeft.svg @@ -0,0 +1,50 @@ + diff --git a/static/icons/bi-ltr-stacked.svg b/static/icons/bi-ltr-stacked.svg new file mode 100644 index 0000000000..27fb13f535 --- /dev/null +++ b/static/icons/bi-ltr-stacked.svg @@ -0,0 +1,26 @@ + diff --git a/static/icons/bi-rtl-heRight.svg b/static/icons/bi-rtl-heRight.svg new file mode 100644 index 0000000000..67a7c095d0 --- /dev/null +++ b/static/icons/bi-rtl-heRight.svg @@ -0,0 +1,50 @@ + diff --git a/static/icons/bi-rtl-stacked.svg b/static/icons/bi-rtl-stacked.svg new file mode 100644 index 0000000000..035734e83f --- /dev/null +++ b/static/icons/bi-rtl-stacked.svg @@ -0,0 +1,26 @@ + diff --git a/static/icons/enlarge_font.svg b/static/icons/enlarge_font.svg new file mode 100644 index 0000000000..3c1ff999d6 --- /dev/null +++ b/static/icons/enlarge_font.svg @@ -0,0 +1,3 @@ + diff --git a/static/icons/mixed-beside-ltrrtl.svg b/static/icons/mixed-beside-ltrrtl.svg new file mode 100644 index 0000000000..f19de475c1 --- /dev/null +++ b/static/icons/mixed-beside-ltrrtl.svg @@ -0,0 +1,50 @@ + diff --git a/static/icons/mixed-beside-rtlltr.svg b/static/icons/mixed-beside-rtlltr.svg new file mode 100644 index 0000000000..a35ebe96f5 --- /dev/null +++ b/static/icons/mixed-beside-rtlltr.svg @@ -0,0 +1,50 @@ + diff --git a/static/icons/mixed-stacked-ltrrtl (1).svg b/static/icons/mixed-stacked-ltrrtl (1).svg new file mode 100644 index 0000000000..a0d8d6bb75 --- /dev/null +++ b/static/icons/mixed-stacked-ltrrtl (1).svg @@ -0,0 +1,26 @@ + diff --git a/static/icons/mixed-stacked-ltrrtl.svg b/static/icons/mixed-stacked-ltrrtl.svg new file mode 100644 index 0000000000..a0d8d6bb75 --- /dev/null +++ b/static/icons/mixed-stacked-ltrrtl.svg @@ -0,0 +1,26 @@ + diff --git a/static/icons/mixed-stacked-rtlltr.svg b/static/icons/mixed-stacked-rtlltr.svg new file mode 100644 index 0000000000..3e088068f8 --- /dev/null +++ b/static/icons/mixed-stacked-rtlltr.svg @@ -0,0 +1,26 @@ + diff --git a/static/icons/mono-continuous.svg b/static/icons/mono-continuous.svg new file mode 100644 index 0000000000..f84c2f3fa8 --- /dev/null +++ b/static/icons/mono-continuous.svg @@ -0,0 +1,26 @@ + diff --git a/static/icons/mono-segmented.svg b/static/icons/mono-segmented.svg new file mode 100644 index 0000000000..9f1b6bffa9 --- /dev/null +++ b/static/icons/mono-segmented.svg @@ -0,0 +1,5 @@ + diff --git a/static/icons/reduce_font.svg b/static/icons/reduce_font.svg new file mode 100644 index 0000000000..0714abe7fb --- /dev/null +++ b/static/icons/reduce_font.svg @@ -0,0 +1,3 @@ + diff --git a/static/img/translation.svg b/static/img/translation.svg index d543bfec55..8d2ab66e60 100644 --- a/static/img/translation.svg +++ b/static/img/translation.svg @@ -1,4 +1,27 @@ - + + + + diff --git a/static/js/LayoutButtons.jsx b/static/js/LayoutButtons.jsx new file mode 100644 index 0000000000..acd070c7e2 --- /dev/null +++ b/static/js/LayoutButtons.jsx @@ -0,0 +1,69 @@ +import React from 'react'; +import {useContext} from "react"; +import { ContentLanguageContext } from "./context"; +import {InterfaceText, RadioButton, layoutOptions, layoutLabels} from "./Misc"; +import PropTypes from "prop-types"; + +const calculateLayoutState = (language, textsData, panelMode) => { + const primaryDir = textsData?.primaryDirection; + const translationDir = textsData?.translationDirection; + return (language !== 'bilingual') ? 'mono' //one text + : (primaryDir == translationDir || panelMode === 'Sheet') ? 'mixed' //two texts with different directions + : (primaryDir === 'rtl') ? 'bi-rtl' //two rtl texts + : 'bi-ltr'; //two ltr texts +}; + +const getPath = (layoutOption, layoutState, textsData) => { + if (layoutState === 'mixed') { + const primaryDirection = textsData?.primaryDirection || 'rtl'; //no primary is the case of sheet + const translationDirection = textsData?.translationDirection || primaryDirection.split('').reverse().join(''); //when there is an empty translation it has no direction. we will show the button as opposite layouts. + const directions = (layoutOption === 'heLeft') ? `${primaryDirection}${translationDirection}` //heLeft means primary in left + : `${translationDirection}${primaryDirection}`; + if (layoutOption !== 'stacked') { + layoutOption = 'beside'; + } + layoutOption = `${layoutOption}-${directions}`; + } + return `/static/icons/${layoutState}-${layoutOption}.svg`; +}; + +const LayoutButton = ({layoutOption, layoutState}) => { + const {language, textsData, setOption, layout} = useContext(ContentLanguageContext); + const path = getPath(layoutOption, layoutState, textsData); + const optionName = (language === 'bilingual') ? 'biLayout' : 'layout'; + const checked = layout === layoutOption; + return ( +