Skip to content

Commit 04709ae

Browse files
committed
feat: added a futuristic fancy button. Layout mods
1 parent b9d5346 commit 04709ae

File tree

8 files changed

+108
-11
lines changed

8 files changed

+108
-11
lines changed

app/Http/Middleware/HandleInertiaRequests.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function share(Request $request): array
4747
'error' => $request->session()->get('error'),
4848
];
4949
},
50-
'siteLogo' => '/img/laravelte-logo.png',
50+
'siteLogo' => config('app.logo'),
5151
'siteName' => config('app.name'),
5252
'locale' => Session::get('locale') ?? App::getLocale(),
5353
]);

resources/css/app.css

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,7 @@ body, p, h1, h2, h3 {
3636
.checkbox {
3737
@apply ml-2 text-sm font-medium text-gray-900 dark:text-gray-300
3838
}
39-
.scrollbar-hidden::-webkit-scrollbar {
40-
display: none;
41-
}
39+
4240

4341
figcaption {
4442
@apply text-sm italic mt-1;
@@ -145,3 +143,24 @@ table .actions {
145143
.modal-footer {
146144
@apply mt-3 p-6 space-y-6 border-t border-gray-600 flex justify-end items-baseline gap-3;
147145
}
146+
147+
148+
/* =========== scrollbar ================= */
149+
::-webkit-scrollbar {
150+
width: 5px;
151+
}
152+
::-webkit-scrollbar-track {
153+
background: #f1f1f1;
154+
border-radius: 10px;
155+
}
156+
::-webkit-scrollbar-thumb {
157+
background: #e3c7fc;
158+
}
159+
::-webkit-scrollbar-thumb:hover {
160+
background: #b874f8;
161+
border-radius: 10px;
162+
}
163+
.scrollbar-hidden::-webkit-scrollbar {
164+
/* display: none; */
165+
width: 0px;
166+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
<script lang="ts">
2+
import { onMount } from 'svelte'
3+
4+
export let text = 'Hello'
5+
type ButtonSize = 'n' | 'sm' | 'lg'
6+
export let size: ButtonSize = 'n'
7+
8+
let btnElement: HTMLButtonElement
9+
10+
onMount(() => {
11+
btnElement.addEventListener('mousemove', e => {
12+
let rect = e.target?.getBoundingClientRect()
13+
let x = e.clientX * 3 - rect.left
14+
btnElement.style.setProperty('--x', `${x}deg`)
15+
})
16+
17+
btnElement.addEventListener('mouseleave', e => {
18+
btnElement.style.setProperty('--x', `45deg`)
19+
})
20+
})
21+
</script>
22+
23+
<button {...$$restProps} bind:this={btnElement} class="fancy-btn-{size}">
24+
<i />
25+
<i />
26+
<span class="overlay">&nbsp</span>
27+
<span class="relative text-white">
28+
<slot>
29+
{text}
30+
</slot>
31+
</span>
32+
</button>
33+
34+
<style lang="css">
35+
:root {
36+
--x: 45deg;
37+
}
38+
button.fancy-btn-n {
39+
@apply px-5 py-2.5;
40+
}
41+
button.fancy-btn-sm {
42+
@apply px-4 py-2;
43+
}
44+
button.fancy-btn-lg {
45+
@apply px-6 py-3;
46+
}
47+
button {
48+
@apply relative -inset-[2px] inline-block rounded;
49+
}
50+
button i {
51+
@apply absolute -inset-[2px] block rounded;
52+
}
53+
button i,
54+
button i:nth-child(2) {
55+
background: linear-gradient(var(--x), #00ccff, #0e1538, #0e1538, #d400d4);
56+
}
57+
button i:nth-child(2) {
58+
filter: blur(10px);
59+
}
60+
button span.overlay {
61+
@apply absolute top-0 left-0 w-full h-full flex justify-center items-center bg-gray-900/70 uppercase text-white rounded border-primary-900 overflow-hidden;
62+
letter-spacing: 2px;
63+
}
64+
button span.overlay:before {
65+
content: '';
66+
@apply absolute top-0 left-[-50%] w-full h-full bg-white/[0.075];
67+
transform: skew(25deg);
68+
}
69+
</style>

resources/ts/Components/Footer.svelte

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,7 @@
77
<div class="max-w-7xl mx-auto py-12 px-4 sm:px-6 lg:py-16 lg:px-8">
88
<div class="xl:grid xl:grid-cols-3 xl:gap-8">
99
<div class="space-y-8 xl:col-span-1">
10-
<img
11-
class="h-10"
12-
src="https://tailwindui.com/img/logos/workflow-mark.svg?color=warmGray&shade=400"
13-
alt="Company name"
14-
/>
10+
<img class="h-10" src={$page.props.siteLogo} alt={$page.props.siteName} />
1511
<p class="text-warm-gray-400 text-base">
1612
Making the world a better place through constructing elegant hierarchies.
1713
</p>

resources/ts/Components/Hero.svelte

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<script>
22
import { page } from '@inertiajs/svelte'
3+
import { FancyButton, Icon } from '.'
34
</script>
45

56
<div class="pt-8 overflow-hidden sm:pt-12 lg:relative lg:py-48">
@@ -131,6 +132,15 @@
131132
</div>
132133
</div>
133134
</div>
135+
<br />
136+
<div class="lg:float-right lg:pr-10">
137+
<a href="https://github.com/SyntaxLexx/laravelte" class="no-underline" target="_blank">
138+
<FancyButton size="lg">
139+
View on Github
140+
<Icon name="link-external" />
141+
</FancyButton>
142+
</a>
143+
</div>
134144
</div>
135145
</div>
136146
</div>
@@ -167,7 +177,7 @@
167177
<img
168178
class="w-full rounded-md shadow-xl ring-1 ring-black ring-opacity-5 lg:h-full lg:w-auto lg:max-w-none"
169179
src="https://tailwindui.com/img/component-images/task-app-rose.jpg"
170-
alt=""
180+
alt="img"
171181
/>
172182
</div>
173183
</div>

resources/ts/Components/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import Button from './Button.svelte';
22
import Circle from './Circle.svelte';
33
import Divider from './Divider.svelte';
44
import DisplayErrors from './DisplayErrors.svelte'
5+
import FancyButton from './FancyButton.svelte'
56
import Icon from './Icon.svelte';
67
import Input from './Input.svelte';
78
import Loading from './Loading.svelte';
@@ -18,6 +19,7 @@ export {
1819
Circle,
1920
DisplayErrors,
2021
Divider,
22+
FancyButton,
2123
Icon,
2224
Input,
2325
Loading,

resources/ts/Layouts/AppLayout.svelte

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@
126126
<li>
127127
<a
128128
href={item.route}
129+
use:inertia
129130
class="nav-item"
130131
aria-current="page"
131132
on:click={() => (isNavCollapsed = true)}>{item.title}</a

resources/views/app.blade.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
@inertiaHead
3030
</head>
31-
<body class="font-sans antialiased" data-theme="sahara">
31+
<body class="font-sans antialiased h-full">
3232
@inertia
3333
</body>
3434
</html>

0 commit comments

Comments
 (0)