Skip to content

Commit

Permalink
fix(modified): fix modified tooltip clipping
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiegyoung committed Dec 17, 2023
1 parent 22b0357 commit 6beb5ca
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 15 deletions.
55 changes: 41 additions & 14 deletions src/components/atoms/Modified.module.css
Original file line number Diff line number Diff line change
@@ -1,37 +1,64 @@
.tooltip {
display: inline-flex;
cursor: help;
align-items: flex-start;
}

.tooltipWrapper {
position: absolute;
margin-left: 124px;
}

.modifiedText {
position: relative;
cursor: help;
color: white;
margin: 0;
}

.tooltip .tooltiptext {
visibility: hidden;
width: 200px;
.tooltipText {
background-color: var(--color-card);
color: white;
text-align: center;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
border-radius: 6px;
padding: 10px;
width: 150px;
position: absolute;
z-index: 1;
bottom: 150%;
left: 0%;
margin-left: -80px;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
height: fit-content;
bottom: 0;
right: 0;
opacity: 0;
pointer-events: none;
transition: opacity 0.1s ease-in-out;
margin-bottom: 10px;
}

@media (prefers-reduced-motion) {
transition: none;
}


.tooltip:hover .tooltipText {
opacity: 1;
pointer-events: auto;
}

.tooltipText:hover {
opacity: 1;
pointer-events: auto;
}

.tooltip .tooltiptext::after {
.tooltipText::after {
content: '';
position: absolute;
top: 100%;
left: 50%;
margin-left: -5px;
border-width: 5px;
margin-left: -10px;
border-width: 10px;
padding-bottom: 20px;
border-style: solid;
border-color: var(--color-card) transparent transparent transparent;
}

.tooltip:hover .tooltiptext {
.modifiedText:hover .tooltipText {
visibility: visible;
}
4 changes: 3 additions & 1 deletion src/components/atoms/Modified.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@ export default function Modified({ children }: { children: string }) {
return (
<span className={styles.tooltip}>
(modified)
<span className={styles.tooltiptext}>{children}</span>
<span className={styles.tooltipWrapper}>
<span className={styles.tooltipText}>{children}</span>
</span>
</span>
);
}

1 comment on commit 6beb5ca

@vercel
Copy link

@vercel vercel bot commented on 6beb5ca Dec 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.