Skip to content

Commit

Permalink
Tweaking contact icon and animation.
Browse files Browse the repository at this point in the history
  • Loading branch information
theruther4d committed Jul 24, 2021
1 parent 1def9bd commit 23c90ae
Show file tree
Hide file tree
Showing 5 changed files with 57 additions and 16 deletions.
12 changes: 9 additions & 3 deletions src/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ export function Footer() {
const input = useRef<HTMLInputElement | null>(null);
const [copied, setCopied] = useState(false);
const [failed, setFailed] = useState(false);
const CopyIcon = failed ? CopyFailed : copied ? CopySuccess : Copy;

const onSelect = () => {
if (!input.current) return;
Expand All @@ -40,7 +39,6 @@ export function Footer() {
navigator.clipboard.writeText(address);

setCopied(true);

clearTimeout(resetTimer.current as number);
resetTimer.current = setTimeout(function resetCopiedState() {
if (unmounted.current) return;
Expand Down Expand Up @@ -99,7 +97,15 @@ export function Footer() {
onClick={onCopy}
title="Copy email address to clipboard"
>
<CopyIcon width={24} height={24} />
<div
className={`icon-wrap ${
failed ? "failed" : copied ? "success" : ""
}`}
>
<CopySuccess />
<Copy />
<CopyFailed />
</div>
</button>
<div className="email-wrap">
<input
Expand Down
38 changes: 36 additions & 2 deletions src/footer/footer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@ $img_size: 173px;

.contact-button {
max-width: 100%;
max-height: 4rem;
display: flex;
justify-content: center;
position: relative;
Expand All @@ -174,15 +175,42 @@ $img_size: 173px;
margin-bottom: 1rem;
}

/*button*/
.copy {
border-radius: 0 2rem 2rem 0;
border: 2px solid white;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
background: white;
padding: calc(1rem - 2px) 1.5rem;
padding: 0;
order: 2;
width: 4.5rem;
height: 4rem;
position: relative;
overflow: hidden;

.icon-wrap {
transition: transform 0.25s ease;
position: absolute;
left: 1rem;
top: 0;
min-height: 12rem;
display: flex;
flex-direction: column;
align-items: center;
justify-content: space-around;
transform: translateY(-4rem);

&.success {
transform: translateY(0);
}

&.failed {
transform: translateY(-8rem);
}
}

.fill-target {
fill: black;
Expand All @@ -200,7 +228,13 @@ $img_size: 173px;
}

svg {
margin-right: 0.5rem;
width: 1.5rem;
height: 1.5rem;

@media all and (min-width: 350px) {
width: 2rem;
height: 2rem;
}
}

.email-wrap {
Expand Down
8 changes: 4 additions & 4 deletions src/footer/icons/clipboard-check.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: 4 additions & 4 deletions src/footer/icons/clipboard-sad.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions src/footer/icons/clipboard.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

1 comment on commit 23c90ae

@vercel
Copy link

@vercel vercel bot commented on 23c90ae Jul 24, 2021

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.