Skip to content

Commit 92eb80d

Browse files
Merge pull request #307 from Muhammed-Rahif/alpha
Alpha
2 parents 0aa2428 + 1b80988 commit 92eb80d

File tree

11 files changed

+77
-14
lines changed

11 files changed

+77
-14
lines changed

src/assets/css/fonts.css

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,8 @@
3232
font-family: 'Parkinsans';
3333
src: url('../../assets/fonts/Parkinsans-VariableFont.ttf');
3434
}
35+
36+
@font-face {
37+
font-family: 'JetBrains Mono';
38+
src: url('../../assets/fonts/JetBrainsMono-VariableFont.ttf');
39+
}
187 KB
Binary file not shown.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}
2+
><path
3+
fill="currentColor"
4+
d="m15.68 0l2.096 2.38s1.84-.512 2.709.358c.868.87 1.584 1.638 1.584 1.638l-.562 1.381l.715 2.047s-2.104 7.98-2.35 8.955c-.486 1.919-.818 2.66-2.198 3.633a186 186 0 0 1-4.293 2.916c-.409.256-.92.692-1.38.692s-.97-.436-1.38-.692a186 186 0 0 1-4.293-2.916c-1.38-.973-1.712-1.714-2.197-3.633c-.247-.975-2.351-8.955-2.351-8.955l.715-2.047l-.562-1.381s.716-.768 1.585-1.638c.868-.87 2.708-.358 2.708-.358L8.321 0h7.36zm-3.679 14.936c-.14 0-1.038.317-1.758.69s-1.242.637-1.409.742s-.065.301.087.409s2.194 1.69 2.393 1.866c.198.175.489.464.687.464s.49-.29.688-.464s2.24-1.759 2.392-1.866s.254-.305.087-.41s-.689-.368-1.41-.741c-.72-.373-1.617-.69-1.757-.69m0-11.278s-.409.001-1.022.206s-1.278.46-1.584.46s-2.581-.434-2.581-.434s-2.695 3.262-2.695 3.959s.339.881.68 1.243l2.02 2.149c.192.203.59.511.356 1.066c-.235.555-.58 1.26-.196 1.977c.384.716 1.042 1.194 1.464 1.115c.421-.08 1.412-.598 1.776-.834c.364-.237 1.518-1.19 1.518-1.554s-1.193-1.02-1.413-1.168c-.22-.15-1.226-.725-1.247-.95c-.02-.227-.012-.293.284-.851c.297-.559.831-1.304.742-1.8c-.089-.495-.95-.753-1.565-.986s-1.799-.671-1.947-.74s-.11-.133.339-.175c.448-.043 1.719-.212 2.292-.052s1.552.403 1.632.532c.079.13.149.134.067.579s-.5 2.581-.541 2.96c-.04.38-.12.63.288.724c.409.094 1.097.256 1.333.256s.924-.162 1.333-.256c.408-.093.329-.344.288-.723c-.04-.38-.46-2.516-.541-2.961s-.012-.45.067-.579c.08-.129 1.059-.372 1.632-.532s1.845.009 2.292.052c.449.042.487.107.339.175c-.148.069-1.332.508-1.947.74c-.615.233-1.476.49-1.565.986c-.09.496.445 1.241.742 1.8s.304.624.284.85s-1.026.802-1.247.95c-.22.15-1.413.804-1.413 1.169c0 .364 1.154 1.317 1.518 1.554c.364.236 1.355.755 1.776.834s1.08-.4 1.464-1.115c.384-.716.039-1.422-.195-1.977s.163-.863.355-1.066l2.02-2.149c.341-.362.68-.546.68-1.243s-2.695-3.96-2.695-3.96s-2.274.436-2.58.436s-.972-.256-1.585-.461s-1.022-.206-1.022-.206"
5+
/></svg
6+
>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}
2+
><path
3+
fill="currentColor"
4+
d="M12 0C5.373 0 0 5.373 0 12s5.373 12 12 12s12-5.373 12-12S18.627 0 12 0m0 23C5.925 23 1 18.074 1 12S5.926 1 12 1s11 4.925 11 11s-4.925 11-11 11m10.219-11c0 4.805-3.317 8.833-7.786 9.925c-.27-.521-.53-1.017-.749-1.438c.645.249 1.93.718 2.208.615c.376-.144.282-3.149-.14-3.245c-.338-.075-1.632.837-2.141 1.209l.034.156c.078.397.144.993.03 1.247q-.001.007-.004.013a.2.2 0 0 1-.068.088c-.284.188-1.081.284-1.503.188l-.064-.02c-.694.396-2.01 1.109-2.25.971c-.329-.188-.377-2.676-.329-3.288c.035-.46 1.653.286 2.442.679c.174-.163.602-.272.98-.31c-.57-1.389-.99-2.977-.733-4.105q.001.003.002.002c.356.248 2.73 1.05 3.91 1.027s3.114-.743 2.903-1.323c-.212-.58-2.135.51-4.142.324c-1.486-.138-1.748-.804-1.42-1.29c.414-.611 1.168.116 2.411-.256c1.245-.371 2.987-1.035 3.632-1.397c1.494-.833-.625-1.177-1.125-.947c-.474.22-2.123.637-2.889.82c.428-1.516-.603-4.149-1.757-5.3c-.376-.376-.951-.612-1.603-.736c-.25-.344-.654-.671-1.225-.977a5.77 5.77 0 0 0-3.595-.584l-.024.004l-.034.004l.004.002c-.148.028-.237.08-.357.098c.148.016.705.276 1.057.418c-.174.068-.412.108-.596.184a.8.8 0 0 0-.204.056c-.173.08-.303.375-.3.515c.84-.086 2.082-.026 2.991.246c-.644.09-1.235.258-1.661.482l-.048.028q-.082.03-.152.066c-1.367.72-1.971 2.405-1.611 4.424c.323 1.824 1.665 8.088 2.29 11.064c-3.973-1.4-6.822-5.186-6.822-9.639C1.781 6.356 6.356 1.781 12 1.781S22.219 6.356 22.219 12M9.095 9.581a.758.758 0 1 0 0 1.516a.758.758 0 0 0 0-1.516m.338.702a.196.196 0 1 1 0-.392a.196.196 0 0 1 0 .392m4.724-1.043a.65.65 0 1 0 0 1.299a.65.65 0 0 0 0-1.3zm.29.601a.168.168 0 1 1 0-.336a.168.168 0 0 1 0 .336M9.313 8.146s-.571-.26-1.125.09c-.554.348-.534.704-.534.704s-.294-.656.49-.978c.786-.32 1.17.184 1.17.184zm5.236-.052s-.41-.234-.73-.23c-.654.008-.831.296-.831.296s.11-.688.945-.55a.84.84 0 0 1 .616.484"
5+
/></svg
6+
>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}
2+
><path
3+
fill="currentColor"
4+
d="M21.456 10.154c.123.659.19 1.348.19 2.067c0 5.624-3.764 9.623-9.449 9.623A9.84 9.84 0 0 1 2.353 12a9.84 9.84 0 0 1 9.844-9.844c2.658 0 4.879.978 6.583 2.566l-2.775 2.775V7.49c-1.033-.984-2.344-1.489-3.808-1.489c-3.248 0-5.888 2.744-5.888 5.993s2.64 5.999 5.888 5.999c2.947 0 4.953-1.686 5.365-4h-5.365v-3.839z"
5+
/></svg
6+
>

src/lib/components/icons/GoogleLine.svelte

Lines changed: 0 additions & 6 deletions
This file was deleted.
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}
2+
><path
3+
fill="currentColor"
4+
d="M5 3v16l3.72 2L18 15.82v-4.09L9.77 8.95l1.61 3.89L13.94 14L8.7 16.92V4.27z"
5+
/></svg
6+
>
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<svg xmlns="http://www.w3.org/2000/svg" width="1em" height="1em" viewBox="0 0 24 24" {...$$props}
2+
><path
3+
fill="currentColor"
4+
d="M10.5 7.59L8.16 13.2L5.85 7.59H2l4.29 9.64l-1.54 3.47H8.5l5.74-13.11zm4.5 5.14c-1.37 0-2.41 1.04-2.41 2.27c0 1.17 1 2.16 2.34 2.16c1.39 0 2.43-1.03 2.43-2.26c0-1.21-1-2.17-2.36-2.17m2.72-9.43l-3.83 8.59h4.28L22 3.3z"
5+
/></svg
6+
>

src/lib/components/menubar/SearchMenu.svelte

Lines changed: 30 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
<script lang="ts">
2-
import GoogleLineIcon from '@/components/icons/GoogleLine.svelte';
2+
import GoogleIcon from '@/components/icons/Google.svelte';
3+
import MicrosoftBing from '@/components/icons/MicrosoftBing.svelte';
4+
import DuckDuckGo from '@/components/icons/DuckDuckGo.svelte';
5+
import Yahoo from '@/components/icons/Yahoo.svelte';
6+
import Brave from '@/components/icons/Brave.svelte';
37
import * as Menubar from '@/components/ui/menubar';
48
import { Notpad } from '@/helpers/notpad';
59
</script>
@@ -14,9 +18,30 @@
1418
Go To<Menubar.Shortcut>Ctrl+G</Menubar.Shortcut>
1519
</Menubar.Item>
1620
<Menubar.Separator />
17-
<Menubar.Item onclick={() => Notpad.searchOptions.searchOnWeb()}>
18-
Search on Google
19-
<GoogleLineIcon class="ml-auto text-muted-foreground" />
20-
</Menubar.Item>
21+
<Menubar.Sub>
22+
<Menubar.SubTrigger>Search on</Menubar.SubTrigger>
23+
<Menubar.SubContent>
24+
<Menubar.Item onclick={() => Notpad.searchOptions.searchOnWeb('google')}>
25+
Google
26+
<GoogleIcon class="ml-auto text-muted-foreground" />
27+
</Menubar.Item>
28+
<Menubar.Item onclick={() => Notpad.searchOptions.searchOnWeb('bing')}>
29+
Bing
30+
<MicrosoftBing class="ml-auto text-muted-foreground" />
31+
</Menubar.Item>
32+
<Menubar.Item onclick={() => Notpad.searchOptions.searchOnWeb('duckduckgo')}>
33+
DuckDuckGo
34+
<DuckDuckGo class="ml-3 text-muted-foreground" />
35+
</Menubar.Item>
36+
<Menubar.Item onclick={() => Notpad.searchOptions.searchOnWeb('yahoo')}>
37+
Yahoo
38+
<Yahoo class="ml-auto text-muted-foreground" />
39+
</Menubar.Item>
40+
<Menubar.Item onclick={() => Notpad.searchOptions.searchOnWeb('brave')}>
41+
Brave Search
42+
<Brave class="ml-auto text-muted-foreground" />
43+
</Menubar.Item>
44+
</Menubar.SubContent>
45+
</Menubar.Sub>
2146
</Menubar.Content>
2247
</Menubar.Menu>

src/lib/helpers/menubar/search-options.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,15 @@ import { isTauri } from '@/src/lib';
55
import { open as tauriLaunchUrl } from '@tauri-apps/plugin-shell';
66

77
export class SearchOptions {
8-
public searchOnWeb = (editorId?: string) => {
8+
private searchEngines = {
9+
google: 'google.com/search',
10+
bing: 'bing.com/search',
11+
duckduckgo: 'duckduckgo.com/',
12+
yahoo: 'search.yahoo.com/search',
13+
brave: 'search.brave.com/search'
14+
} as const;
15+
16+
public searchOnWeb = (searchEngine: keyof typeof this.searchEngines, editorId?: string) => {
917
const editor = Notpad.editors.getEditor(editorId);
1018
if (!editor) return;
1119

@@ -16,7 +24,7 @@ export class SearchOptions {
1624
selectedText = selectedText?.trim();
1725
if (!selectedText) return Notpad.showError('Please select some text to search on the web.');
1826

19-
const url = `https://www.google.com/search?q=${encodeURIComponent(selectedText)}`;
27+
const url = `https://${this.searchEngines[searchEngine]}?q=${encodeURIComponent(selectedText)}`;
2028

2129
if (isTauri) {
2230
tauriLaunchUrl(url);

0 commit comments

Comments
 (0)