Skip to content

Commit

Permalink
RTL/LTR switch for info modal close button
Browse files Browse the repository at this point in the history
  • Loading branch information
rsimon committed Feb 28, 2024
1 parent b42cc1b commit 1d57a3c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const App = () => {

<MyLocationControl />

<InfoControl className="kima-welcome">
<InfoControl className="kima-welcome" dir="rtl">
<h1>ברוכות וברוכים הבאים לממשק הגילוי והחיפוש הגיאוגרפי של הספרייה הלאומית!</h1>

<p>הממשק מאפשר לצפות באוצרות הדיגיטליים של הספרייה על גבי מפה אינטראקטיבית. כך תוכלו לאתר רשומות לפי המקום בו הן נוצרו או לפי המקום אותו הן מתארות.
Expand Down
6 changes: 6 additions & 0 deletions src/peripleo/controls/Info/InfoControl.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@
cursor: pointer;
}

.rtl .p6o-info-modal-close {
left: 25px;
right: auto;
}


.p6o-info-modal-close.mobile {
right: 10px;
}
Expand Down
3 changes: 3 additions & 0 deletions src/peripleo/controls/Info/InfoControl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ export type InfoProps = {

className?: string

dir?: 'rtl' | 'ltr'

}

export const InfoControl = (props: InfoProps) => {
Expand All @@ -29,6 +31,7 @@ export const InfoControl = (props: InfoProps) => {
{modalOpen && (
<InfoModal
className={props.className}
dir={props.dir}
onClose={() => setModalOpen(false)}>
{props.children}
</InfoModal>
Expand Down
10 changes: 9 additions & 1 deletion src/peripleo/controls/Info/InfoModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ export type InfoModalProps = {

className?: string

dir?: 'rtl' | 'ltr'

onClose: EventHandler<any>

}
Expand All @@ -35,10 +37,16 @@ export const InfoModal = (props: InfoModalProps) => {
props.onClose(evt);
}

const className = [
'p6o-info-modal-bg',
props.className,
props.dir
].filter(Boolean).join(' ');

return ReactDOM.createPortal(
<div
ref={el}
className={props.className ? `p6o-info-modal-bg ${props.className}` : 'p6o-info-modal-bg'}
className={className}
onClick={onClick}>
<button
className={device.size === Size.DESKTOP ? 'p6o-info-modal-close' : 'p6o-info-modal-close mobile'}
Expand Down

0 comments on commit 1d57a3c

Please sign in to comment.