-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1311 from saiTharunDusa/master
Fixed the issue #1206
- Loading branch information
Showing
9 changed files
with
390 additions
and
39 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -470,6 +470,11 @@ [email protected]: | |
jsonfile "^3.0.0" | ||
universalify "^0.1.0" | ||
|
||
fsevents@~2.3.2: | ||
version "2.3.2" | ||
resolved "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz" | ||
integrity sha512-xiqMQR4xAeHTuB9uWm+fFRcIOgKBMiOBP+eXiyT7jsgVCq1bkVygt00oASowB7EdtpOHaaPgKt812P9ab+DDKA== | ||
|
||
function-bind@^1.1.1: | ||
version "1.1.1" | ||
resolved "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
desktop-app/src/renderer/components/Masonry/MasonryLayout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import React from 'react'; | ||
import { Icon } from '@iconify/react'; | ||
import { PREVIEW_LAYOUTS } from 'common/constants'; | ||
import { useDispatch, useSelector } from 'react-redux'; | ||
import useKeyboardShortcut, { | ||
SHORTCUT_CHANNEL, | ||
} from 'renderer/components/KeyboardShortcutsManager/useKeyboardShortcut'; | ||
import Toggle from 'renderer/components/Toggle'; | ||
import { selectLayout, setLayout } from 'renderer/store/features/renderer'; | ||
|
||
const MasonryLayout = () => { | ||
const layout = useSelector(selectLayout); | ||
const dispatch = useDispatch(); | ||
|
||
const handleLayout = () => { | ||
if (layout === PREVIEW_LAYOUTS.MASONRY) | ||
dispatch(setLayout(PREVIEW_LAYOUTS.FLEX)); | ||
else dispatch(setLayout(PREVIEW_LAYOUTS.MASONRY)); | ||
}; | ||
|
||
useKeyboardShortcut(SHORTCUT_CHANNEL.PREVIEW_LAYOUT, handleLayout); | ||
|
||
return ( | ||
<div className="flex flex-row items-center justify-start px-4"> | ||
<span className="w-1/2">Masonry Layout</span> | ||
<div className="flex w-fit items-center gap-3 border-l px-5 dark:border-slate-400"> | ||
<Icon icon="mdi:view-grid-outline" /> | ||
<Toggle | ||
isOn={layout === PREVIEW_LAYOUTS.MASONRY} | ||
onChange={(e) => { | ||
if (e.target.checked) { | ||
dispatch(setLayout(PREVIEW_LAYOUTS.MASONRY)); | ||
} else { | ||
dispatch(setLayout(PREVIEW_LAYOUTS.COLUMN)); | ||
} | ||
}} | ||
/> | ||
<Icon icon="mdi:view-masonry-outline" /> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default MasonryLayout; |
Oops, something went wrong.