Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Add Dark Mode Support #9

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions src/app.html
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>
<body data-sveltekit-preload-data="hover">
<div style="display: contents">%sveltekit.body%</div>
</body>
</html>
<html lang="en" class="dark">

<head>
<meta charset="utf-8" />
<link rel="icon" href="%sveltekit.assets%/favicon.png" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
%sveltekit.head%
</head>

<body data-sveltekit-preload-data="hover" class="bg-white dark:bg-gray-800">
<div style="display: contents">%sveltekit.body%</div>
</body>

</html>
15 changes: 11 additions & 4 deletions src/routes/+page.svelte
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<script lang="ts">
import { Select, Label, Input, Button, Toggle, P } from 'flowbite-svelte';
import { Select, Label, Input, Button, Toggle, P, DarkMode, Tooltip } from 'flowbite-svelte';

let selected = $state('feat');
let commitTypes = [
{ value: 'build', name: 'build' },
Expand Down Expand Up @@ -34,6 +35,12 @@
</script>

<form>
<div class="flex justify-end m-5">
<DarkMode
class="text-gray-500 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-700 rounded-lg text-xl p-2"
/>
<Tooltip>Toggle dark mode</Tooltip>
</div>
<div class="m-auto flex w-[80%] items-center space-x-2 mt-10">
<div class="flex flex-col" style="width: 20%;">
<P class="mb-2">Select commit type*:</P>
Expand All @@ -59,9 +66,9 @@
<Button class="mt-4" on:click={copyToClipboard}>Copy</Button>
</div>
<div class="m-auto mt-4 w-[80%]">
<p class="text-slate-600 text-left">* required</p>
<p class="text-center">Your commit message will be:</p>
<p class="text-center">{commitMessage()}</p>
<P class="text-left text-sm">* required</P>
<P class="text-center">Your commit message will be:</P>
<P class="text-center text-xl">{commitMessage()}</P>
</div>
</form>

Expand Down
2 changes: 1 addition & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export default {
'./src/**/*.{html,js,svelte,ts}',
'./node_modules/flowbite-svelte/**/*.{html,js,svelte,ts}'
],
darkMode: 'selector',
darkMode: 'class',
theme: {
extend: {
colors: {
Expand Down