Skip to content

Commit

Permalink
🍱 [Assets] Replace PNG cursors with SVGs
Browse files Browse the repository at this point in the history
  • Loading branch information
beefchimi committed Jul 25, 2024
1 parent 7c01851 commit 8f0287b
Show file tree
Hide file tree
Showing 20 changed files with 64 additions and 23 deletions.
3 changes: 3 additions & 0 deletions src/assets/img/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Images

Place any images here that we want optimized by Astro. Otherwise, put pre-optimized images in the `/public` folder.
Binary file removed src/assets/img/cursor-auto.png
Binary file not shown.
Binary file removed src/assets/img/cursor-dead.png
Binary file not shown.
Binary file removed src/assets/img/cursor-pointer-clicked.png
Binary file not shown.
Binary file removed src/assets/img/cursor-pointer.png
Binary file not shown.
Binary file removed src/assets/img/cursor-rock-clicked.png
Binary file not shown.
Binary file removed src/assets/img/cursor-rock.png
Binary file not shown.
Binary file removed src/assets/img/cursor-text.png
Binary file not shown.
4 changes: 4 additions & 0 deletions src/assets/svg/cursors/CursorAuto.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/assets/svg/cursors/CursorDead.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 8 additions & 0 deletions src/assets/svg/cursors/CursorDeadClicked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/svg/cursors/CursorHorns.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/svg/cursors/CursorHornsClicked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/svg/cursors/CursorPointer.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions src/assets/svg/cursors/CursorPointerClicked.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions src/assets/svg/cursors/CursorText.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions src/components/Navigation.astro
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ const {id, items = []} = Astro.props;
text-transform: uppercase;
letter-spacing: 0.2rem;
white-space: nowrap;
/* Required for the `rock` cursor to work. */
/* Required for the `horns` cursor to work. */
pointer-events: none;
}

Expand All @@ -182,7 +182,7 @@ const {id, items = []} = Astro.props;
html[data-current-index='12'] .Item:nth-child(13) .Link,
html[data-current-index='13'] .Item:nth-child(14) .Link,
html[data-current-index='14'] .Item:nth-child(15) .Link {
cursor: url('../assets/img/cursor-rock.png'), not-allowed;
cursor: url('../assets/svg/cursors/CursorHorns.svg'), not-allowed;
color: var(--color-primary);
translate: calc(var(--nav-item-shift-x) * -1) 0;
}
Expand All @@ -202,7 +202,7 @@ const {id, items = []} = Astro.props;
html[data-current-index='12'] .Item:nth-child(13) .Link:active,
html[data-current-index='13'] .Item:nth-child(14) .Link:active,
html[data-current-index='14'] .Item:nth-child(15) .Link:active {
cursor: url('../assets/img/cursor-rock-clicked.png'), not-allowed;
cursor: url('../assets/svg/cursors/CursorHornsClicked.svg'), not-allowed;
}

html[data-current-index='0'] .Item:nth-child(1) .Link::before,
Expand Down
6 changes: 5 additions & 1 deletion src/components/ProjectLogo.astro
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,11 @@ const iconProps = {
}

div.ProjectLogo {
cursor: url('../assets/img/cursor-dead.png'), not-allowed;
cursor: url('../assets/svg/cursors/CursorDead.svg'), not-allowed;

&:active {
cursor: url('../assets/svg/cursors/CursorDeadClicked.svg'), not-allowed;
}
}

.ProjectLogo > [data-icon] {
Expand Down
2 changes: 1 addition & 1 deletion src/sections/Intro.astro
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const {id, thumbnail} = Astro.props;
Background image photographed by: Curtis Dulmage
</p>

<p class="paragraph visually-hidden preload-cursors">
<p class="paragraph visually-hidden">
<b>Curtis Dulmage.</b>
<u>Front end web developer.</u>
<i>Ottawa, Canada.</i> Here are a few of my most recent projects. Please
Expand Down
22 changes: 4 additions & 18 deletions src/styles/global.css
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ html {

body {
font-family: 'Outfit Variable', var(--font-stack-sans-serif);
cursor: url('../assets/img/cursor-auto.png'), auto;
cursor: url('../assets/svg/cursors/CursorAuto.svg'), auto;
}

/* --- Page load --- */
Expand Down Expand Up @@ -290,32 +290,18 @@ code,
cite,
blockquote,
figcaption {
cursor: url('../assets/img/cursor-text.png'), text;
cursor: url('../assets/svg/cursors/CursorText.svg'), text;
}

a,
button {
&,
& * {
cursor: url('../assets/img/cursor-pointer.png'), pointer;
cursor: url('../assets/svg/cursors/CursorPointer.svg'), pointer;
}

&:active,
&:active * {
cursor: url('../assets/img/cursor-pointer-clicked.png'), pointer;
cursor: url('../assets/svg/cursors/CursorPointerClicked.svg'), pointer;
}
}

/*
.preload-cursors b {
cursor: url('../assets/img/cursor-drag-clicked.png'), auto;
}
*/

.preload-cursors u {
cursor: url('../assets/img/cursor-pointer-clicked.png'), pointer;
}

.preload-cursors i {
cursor: url('../assets/img/cursor-rock-clicked.png'), pointer;
}

0 comments on commit 8f0287b

Please sign in to comment.