Skip to content

Commit

Permalink
feat: font-family & update timer
Browse files Browse the repository at this point in the history
- Added inter font family
- Reduced update poll timer to 1 hour
  • Loading branch information
HoaX7 committed Oct 26, 2024
1 parent f39568d commit b7a9c78
Show file tree
Hide file tree
Showing 34 changed files with 99 additions and 184 deletions.
2 changes: 1 addition & 1 deletion app/src-tauri/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions app/src-tauri/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "scribe"
version = "0.5.3"
version = "0.5.4"
description = "A note taking app with seamless user experience"
authors = ["HoaX7"]
license = ""
Expand Down Expand Up @@ -30,7 +30,7 @@ cocoa = "0.26.0"
core-graphics = "0.24.0"

[target.'cfg(windows)'.dependencies]
winapi = { version = "0.3.9", features = ["winuser", "dwmapi"] }
winapi = { version = "0.3.9", features = ["winuser", "dwmapi", "shellscalingapi"] }

[features]
# this feature is used for production builds or when `devPath` points to the filesystem and the built-in dev server is disabled.
Expand Down
4 changes: 4 additions & 0 deletions app/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ use tauri::{AppHandle, Manager};
use window_shadows::set_shadow;

fn main() {
#[cfg(target_os = "windows")]
unsafe {
winapi::um::shellscalingapi::SetProcessDpiAwareness(1);
}
std::panic::set_hook(Box::new(|info| {
let msg = match info.payload().downcast_ref::<&'static str>() {
Some(s) => *s,
Expand Down
2 changes: 1 addition & 1 deletion app/src-tauri/tauri.conf.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"package": {
"productName": "scribe",
"version": "0.5.3"
"version": "0.5.4"
},
"tauri": {
"allowlist": {
Expand Down
2 changes: 1 addition & 1 deletion app/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ html,
body {
margin: 0;
height: 100%;
font-family: 'Nunito Regular';
font-family: 'Inter';
}
ul li {
list-style: disc;
Expand Down
Binary file removed app/src/fonts/Helvetica-Bold.woff
Binary file not shown.
Binary file removed app/src/fonts/Helvetica-BoldOblique.woff
Binary file not shown.
Binary file removed app/src/fonts/Helvetica-Oblique.woff
Binary file not shown.
Binary file removed app/src/fonts/Helvetica.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-Black.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-BlackItalic.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-Bold.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-BoldItalic.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-ExtraBold.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-ExtraBoldItalic.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-ExtraLight.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-ExtraLightItalic.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-Italic.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-Light.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-LightItalic.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-Regular.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-SemiBold.woff
Binary file not shown.
Binary file removed app/src/fonts/Nunito-SemiBoldItalic.woff
Binary file not shown.
171 changes: 5 additions & 166 deletions app/src/fonts/font.css
Original file line number Diff line number Diff line change
@@ -1,167 +1,6 @@
@font-face {
font-family: 'Helvetica';
font-style: normal;
font-weight: normal;
src: local('Helvetica'), url('Helvetica.woff') format('woff');
}


@font-face {
font-family: 'Helvetica Oblique';
font-style: normal;
font-weight: normal;
src: local('Helvetica Oblique'), url('Helvetica-Oblique.woff') format('woff');
}


@font-face {
font-family: 'Helvetica Compressed';
font-style: normal;
font-weight: normal;
src: local('Helvetica Compressed'), url('helvetica-compressed-5871d14b6903a.woff') format('woff');
}


@font-face {
font-family: 'Helvetica Rounded Bold';
font-style: normal;
font-weight: normal;
src: local('Helvetica Rounded Bold'), url('helvetica-rounded-bold-5871d05ead8de.woff') format('woff');
}


@font-face {
font-family: 'Helvetica';
font-style: normal;
font-weight: normal;
src: local('Helvetica'), url('Helvetica-Bold.woff') format('woff');
}


@font-face {
font-family: 'Helvetica Bold Oblique';
font-style: normal;
font-weight: normal;
src: local('Helvetica Bold Oblique'), url('Helvetica-BoldOblique.woff') format('woff');
}


@font-face {
font-family: 'Helvetica Light';
font-style: normal;
font-weight: normal;
src: local('Helvetica Light'), url('helvetica-light-587ebe5a59211.woff') format('woff');
}

/* #### Generated By: http://font.download #### */

@font-face {
font-family: 'Nunito Regular';
font-style: normal;
font-weight: normal;
src: local('Nunito Regular'), url('Nunito-Regular.woff') format('woff');
}


@font-face {
font-family: 'Nunito Italic';
font-style: normal;
font-weight: normal;
src: local('Nunito Italic'), url('Nunito-Italic.woff') format('woff');
}


@font-face {
font-family: 'Nunito ExtraLight';
font-style: normal;
font-weight: normal;
src: local('Nunito ExtraLight'), url('Nunito-ExtraLight.woff') format('woff');
}


@font-face {
font-family: 'Nunito ExtraLight Italic';
font-style: normal;
font-weight: normal;
src: local('Nunito ExtraLight Italic'), url('Nunito-ExtraLightItalic.woff') format('woff');
}


@font-face {
font-family: 'Nunito Light';
font-style: normal;
font-weight: normal;
src: local('Nunito Light'), url('Nunito-Light.woff') format('woff');
}


@font-face {
font-family: 'Nunito Light Italic';
font-style: normal;
font-weight: normal;
src: local('Nunito Light Italic'), url('Nunito-LightItalic.woff') format('woff');
}


@font-face {
font-family: 'Nunito SemiBold';
font-style: normal;
font-weight: normal;
src: local('Nunito SemiBold'), url('Nunito-SemiBold.woff') format('woff');
}


@font-face {
font-family: 'Nunito SemiBold Italic';
font-style: normal;
font-weight: normal;
src: local('Nunito SemiBold Italic'), url('Nunito-SemiBoldItalic.woff') format('woff');
}


@font-face {
font-family: 'Nunito Bold';
font-style: normal;
font-weight: normal;
src: local('Nunito Bold'), url('Nunito-Bold.woff') format('woff');
}


@font-face {
font-family: 'Nunito Bold Italic';
font-style: normal;
font-weight: normal;
src: local('Nunito Bold Italic'), url('Nunito-BoldItalic.woff') format('woff');
}


@font-face {
font-family: 'Nunito ExtraBold';
font-style: normal;
font-weight: normal;
src: local('Nunito ExtraBold'), url('Nunito-ExtraBold.woff') format('woff');
}


@font-face {
font-family: 'Nunito ExtraBold Italic';
font-style: normal;
font-weight: normal;
src: local('Nunito ExtraBold Italic'), url('Nunito-ExtraBoldItalic.woff') format('woff');
}


@font-face {
font-family: 'Nunito Black';
font-style: normal;
font-weight: normal;
src: local('Nunito Black'), url('Nunito-Black.woff') format('woff');
}


@font-face {
font-family: 'Nunito Black Italic';
font-style: normal;
font-weight: normal;
src: local('Nunito Black Italic'), url('Nunito-BlackItalic.woff') format('woff');
}
@font-face {
font-family: 'Inter';
font-weight: 400 800;
src: url('./inter/inter-variable-font.ttf');
}
Binary file not shown.
Binary file removed app/src/fonts/helvetica-light-587ebe5a59211.woff
Binary file not shown.
Binary file not shown.
Binary file added app/src/fonts/inter/inter-variable-font.ttf
Binary file not shown.
45 changes: 38 additions & 7 deletions app/src/lib/components/common/DropDown.svelte
Original file line number Diff line number Diff line change
@@ -1,18 +1,49 @@
<script lang="ts">
import { createEventDispatcher } from "svelte";
import Typography from "./Typography.svelte";
import Icon from "./Icon.svelte";
import WindowEvent from "$lib/hooks/WindowEvent.svelte";
export let items: {
type IItem = {
key: string;
name: string;
}[] = [];
export let showDD = false;
export let selectedItem = "Options";
};
export let items: IItem[] = [];
export let selectedItem = {} as IItem;
const dispatch = createEventDispatcher();
let showdd = false;
</script>

<div class="rounded bg-gray-200">
<Typography variant="div" weight="normal" fontSize="base">
{selectedItem}
<!-- <WindowEvent event="mouseup" callback={() => showdd = false} /> -->
<div class="rounded border" on:click|stopPropagation role="none">
<Typography variant="div" weight="normal" fontSize="base" classname="p-1 px-2 flex justify-between items-center cursor-pointer"
on:click={() => showdd = !showdd}
>
{selectedItem.name || "Select"} <Icon src="/assets/images/chevron.svg" width="18" alt="dd" class={showdd ? "rotate-180" : ""} />
</Typography>
{#if showdd}
<hr class="mx-3" />
<div class="mt-2">
{#if items.length === 0}
<Typography variant="div" weight="normal" fontSize="sm" classname="p-1 px-2 text-gray-600">
No Items
</Typography>
{:else}
{#each items as item}
<button class="w-full text-start p-1 px-2 hover:bg-gray-100 disabled:text-gray-600"
on:click={() => {
selectedItem = item;
dispatch("select", item);
}}
disabled={selectedItem.key === item.key}
>
<Typography variant="div" weight="normal" fontSize="base">
{item.name}
</Typography>
</button>
{/each}
{/if}
</div>
{/if}
</div>
5 changes: 1 addition & 4 deletions app/src/lib/components/common/Typography.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</script>


<svelte:element this={variant} class={clsx(classname, `text-${fontSize} font-${weight}`)}>
<svelte:element this={variant} class={clsx(classname, `text-${fontSize} font-${weight}`)} on:click role="none">
<slot />
</svelte:element>

Expand Down Expand Up @@ -46,14 +46,11 @@
}
.font-medium {
font-weight: 500;
font-family: 'Nunito SemiBold';
}
.font-semi-bold {
font-weight: 600;
font-family: 'Nunito Bold';
}
.font-bold {
font-weight: 700;
font-family: 'Nunito ExtraBold';
}
</style>
2 changes: 1 addition & 1 deletion app/src/lib/components/editor/extensions/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const StarterKitOptions = {
code: { HTMLAttributes: { class: "px-1 bg-gray-200 rounded" } },
horizontalRule: { HTMLAttributes: { class: "my-8" } },
codeBlock: false as const,
heading: { HTMLAttributes: { class: "mt-8" } },
heading: { HTMLAttributes: { class: "mt-6" } },
};

export default [
Expand Down
37 changes: 37 additions & 0 deletions app/src/lib/components/settings/tabs/Home.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import { emit } from "@tauri-apps/api/event";
import { TAURI_EVENTS } from "../../../../utils/constants";
import SettingStore from "../../../../store/settings";
import DropDown from "$lib/components/common/DropDown.svelte";
export let settings: SettingProps;
let saving = false;
Expand All @@ -32,6 +33,29 @@
}
saving = false;
};
const fonts = [{
name: "Default",
key: "default"
}, {
name: "Inter",
key: "inter"
}];
let selected = $ctx.defaultFont ? fonts[0] : fonts[1];
const handleSelect = (e: { detail: any; }) => {
const data = e.detail;
let isDefault = false;
if (data.key === fonts[0].key) {
isDefault = true;
}
document.body.style.fontFamily = isDefault ? "unset" : "Inter";
ctx.update((store) => {
store.defaultFont = isDefault;
return store;
});
}
</script>

<div class="relative">
Expand Down Expand Up @@ -76,4 +100,17 @@
new one.
</Typography>
</div>
<div class="mt-3">
<Typography
variant="div"
weight="normal"
fontSize="sm"
classname="text-slate-400 flex gap-1"
>
Font
</Typography>
<div class="mt-1">
<DropDown items={fonts} selectedItem={selected} on:select={handleSelect} />
</div>
</div>
</div>
Loading

0 comments on commit b7a9c78

Please sign in to comment.