Skip to content

Commit

Permalink
Merge pull request #196 from harshit69x/main
Browse files Browse the repository at this point in the history
Fixed the darkmode bug
  • Loading branch information
Muhammed-Rahif authored Oct 3, 2024
2 parents 3305eef + fe2aea4 commit 0918126
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/prettier.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
jobs:
prettier:
name: Prettify code
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Checkout
Expand Down
17 changes: 8 additions & 9 deletions src/lib/components/MenuBar.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
import EditorTitle from '@/components/EditorTitle.svelte';
import { Notpad } from '@/helpers/notpad';
import { editors } from '@/store';
import { toggleMode } from 'mode-watcher';
import { fade } from 'svelte/transition';
import { isTauri } from '$lib';
import screenfull from 'screenfull';
import { toggleMode, mode } from 'mode-watcher';
interface MenuItems {
label: string;
Expand All @@ -29,15 +29,13 @@
shortcut: isTauri ? 'Ctrl+N' : 'Ctrl+Alt+N',
onClick: Notpad.editors.createNew
},
{ label: 'Open...', shortcut: 'Ctrl+O', onClick: Notpad.fileOptions.open },
{
label: 'Save',
shortcut: 'Ctrl+S',
onClick: Notpad.fileOptions.save
},
{ label: 'Save as...', onClick: () => Notpad.fileOptions.save({ saveAs: true }) },
{ type: 'separator' },
{ label: 'Print', shortcut: 'Ctrl+P', onClick: Notpad.editors.printActive },
{ type: 'separator' },
Expand Down Expand Up @@ -82,7 +80,7 @@
shortcut: 'F11',
onClick: () => screenfull.toggle()
},
{ label: 'Dark Mode', onClick: toggleMode }
{ label: 'mode', onClick: toggleMode }
]
},
{
Expand All @@ -94,12 +92,9 @@
let innerWidth = window.innerWidth;
$: isXS = innerWidth <= 450;
/**
* Compact mode is disabled on mobile devices (width <= 450px)
* and on PCs when multiple editors are open.
*/
$: tabsMode = $editors.length > 1;
$: singleEditor = $editors.at(0)!;
$: modeLabel = $mode == 'dark' ? 'Light Mode' : 'Dark Mode';
</script>

<svelte:window bind:innerWidth />
Expand All @@ -114,7 +109,11 @@
<Menubar.Separator />
{:else}
<Menubar.Item on:click={onClick}>
{label}
{#if label == 'mode'}
{modeLabel}
{:else}
{label}
{/if}
{#if shortcut}
<Menubar.Shortcut>{shortcut}</Menubar.Shortcut>
{/if}
Expand Down

0 comments on commit 0918126

Please sign in to comment.