Skip to content

Commit

Permalink
dark mode (#65)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjaudiomv authored Jun 3, 2024
1 parent 51f964d commit c01da5b
Show file tree
Hide file tree
Showing 7 changed files with 272 additions and 61 deletions.
3 changes: 1 addition & 2 deletions package-lock.json

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

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
"name": "bmlt-data-converter",
"version": "0.0.1",
"private": true,
"type": "module",
"scripts": {
"dev": "vite dev",
"build": "vite build",
Expand Down Expand Up @@ -30,13 +31,12 @@
"js2xmlparser": "^5.0.0",
"prettier": "^3.1.1",
"prettier-plugin-svelte": "^3.1.2",
"sass": "^1.71.0",
"svelte": "^4.2.7",
"sass": "^1.77.4",
"svelte-check": "^3.6.0",
"tslib": "^2.4.1",
"typescript": "^5.0.0",
"vite": "^5.0.3",
"xlsx": "https://cdn.sheetjs.com/xlsx-0.20.2/xlsx-0.20.2.tgz"
},
"type": "module"
}
}
1 change: 1 addition & 0 deletions src/app.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.4/css/all.min.css" crossorigin="anonymous" referrerpolicy="no-referrer" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
Expand Down
47 changes: 47 additions & 0 deletions src/components/ThemeSwitcher.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<script lang="ts">
import { theme } from '../stores/themeStore';
function toggleTheme() {
theme.update((current) => (current === 'light' ? 'dark' : 'light'));
}
</script>

<div class="switch-container">
<button class="switch" on:click={toggleTheme} aria-label="Toggle theme">
{#if $theme === 'dark'}
<i class="fas fa-moon icon"></i>
{:else}
<i class="fas fa-sun icon"></i>
{/if}
</button>
</div>

<style>
.switch-container {
display: flex;
padding-top: 10px;
justify-content: center;
align-items: center;
}
.switch {
position: relative;
display: inline-block;
margin-bottom: 5px;
width: 50px;
height: 50px;
border: none;
border-radius: 50%;
cursor: pointer;
transition: background-color 0.3s ease;
}
.switch .icon {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
font-size: 24px;
transition: color 0.3s ease;
}
</style>
Loading

0 comments on commit c01da5b

Please sign in to comment.