Skip to content

Commit d13258f

Browse files
committed
✨ feat: use react for some components, add more props
also allow link-button component to be used inline
1 parent 5f928d1 commit d13258f

File tree

9 files changed

+490
-345
lines changed

9 files changed

+490
-345
lines changed

src/components/LinkButton.astro

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,26 @@
11
---
2+
import { FaArrowUpRightFromSquare } from 'react-icons/fa6';
3+
24
interface Props {
35
href: string;
46
external?: boolean;
7+
showIcon?: boolean;
8+
title?: string;
9+
spacing?: boolean;
510
}
611
7-
const { href, external } = Astro.props;
12+
const { href, external, title, showIcon = true, spacing = true } = Astro.props;
813
---
914

10-
<a class="link-button" href={ href }>
11-
<slot /> <i style=`display: ${external ? "initial" : "none"}`
12-
class="nf nf-oct-arrow_up_right" />
15+
<a class=`link-button ${spacing ? "space" : ""}` {href}
16+
target={external ? "_blank" : "_self"} {title}>
17+
18+
<slot />
19+
<FaArrowUpRightFromSquare className="external-icon" style={{
20+
display: showIcon && external ? "initial" : "none",
21+
marginLeft: 6,
22+
marginTop: 3
23+
}} />
1324
</a>
1425

1526
<style lang="scss">
@@ -18,29 +29,40 @@ const { href, external } = Astro.props;
1829

1930
a {
2031
display: inline-flex;
21-
margin-inline: 8px;
22-
font-size: normal;
32+
font-size: 1.04em;
2333
font-weight: 600;
24-
width: fit-content;
25-
box-sizing: content-box;
2634
color: inherit;
2735

28-
border: solid 0.032em colors.$accent-color;
29-
padding: 5px 8px;
36+
box-shadow: inset 0 0 0 1px colors.$accent-color-dark;
3037
border-radius: 12px;
3138
text-decoration: none;
32-
-webkit-tap-highlight-color: transparent;
3339
transition: 150ms linear;
3440

35-
&:hover {
36-
color: white;
37-
background-color: colors.$accent-color-dark;
41+
&.space {
42+
padding: 8px 10px;
43+
margin-inline: 8px;
44+
45+
&:hover {
46+
color: white;
47+
border-width: 2px;
48+
background-color: colors.$accent-color-dark;
49+
50+
body.light & {
51+
box-shadow: inset 0 0 0 1px colors.$accent-color-dark;
52+
background-color: colors.$accent-color-dark;
53+
}
54+
}
3855
}
39-
}
4056

41-
body.light a:hover {
42-
color: black;
43-
background-color: colors.$accent-color;
57+
&:not(.space) {
58+
text-decoration: underline;
59+
text-decoration-thickness: 1px;
60+
box-shadow: none;
61+
62+
&:hover {
63+
text-decoration-color: colors.$accent-color-dark;
64+
}
65+
}
4466
}
4567
</style>
4668

src/components/Navigation.astro

Lines changed: 0 additions & 204 deletions
This file was deleted.

0 commit comments

Comments
 (0)