Skip to content

Commit

Permalink
style: normalize link hover behavior
Browse files Browse the repository at this point in the history
links previously only wrapped the text they were applied to instead of
expanding to fill the parent container. This led to some weird and
unintuitive behavior on hover. This fix normalizes this behavior.
  • Loading branch information
rgildiaz committed Jul 5, 2024
1 parent 237e61a commit ca917c2
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 13 deletions.
10 changes: 6 additions & 4 deletions components/blogPostList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ import utilStyles from "../styles/utils.module.css";
const BlogPost = ({ id, date, title }) => {
return (
<li className={`${utilStyles.listItem} ${utilStyles.flex}`} key={id}>
<Link href={`/blog/${id}`}>{title}</Link>
<small className={utilStyles.lightText}>
<Date dateString={date} />
</small>
<Link href={`/blog/${id}`}>
<p>{title}</p>
<small className={utilStyles.lightText}>
<Date dateString={date} />
</small>
</Link>
</li>
);
};
Expand Down
13 changes: 10 additions & 3 deletions components/layout/layout.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
}

.header::before {
/* This is used to create the blur effect on the header.
These styles aren't on the header element itself for more
specific control over size and positioning without affecting
the header content */
content: "";
position: absolute;
top: 0;
Expand Down Expand Up @@ -42,9 +46,6 @@
}

.header a {
display: block;
height: 100%;
width: 100%;
color: black;
}

Expand Down Expand Up @@ -73,3 +74,9 @@
text-decoration: underline;
text-decoration-style: wavy;
}

.nav a {
display: block;
height: 100%;
width: 100%;
}
5 changes: 0 additions & 5 deletions styles/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,6 @@ a {
text-decoration: none;
}

a:hover {
text-decoration: underline;
font-style: italic;
}

img {
max-width: 100%;
display: block;
Expand Down
17 changes: 16 additions & 1 deletion styles/utils.module.css
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,28 @@

.listItem {
margin: 0 0 1.25rem;
display: block;
}

.listItem:hover p {
text-decoration: underline;
font-style: italic;
}

.listItem p {
margin: 0;
}

.listItem a {
width: 100%;
height: 100%;
}

.lightText {
color: #666;
}

.flex {
.flex {
display: flex;
flex-direction: column;
}

0 comments on commit ca917c2

Please sign in to comment.