Skip to content

Commit 4aaa448

Browse files
adamzielclaude
andauthored
[Website] Add refresh button to the left of address bar (#2828)
Added a circular refresh button with an SVG icon to the left of the address bar input field. The button reloads the current page when clicked: <img width="3762" height="1522" alt="CleanShot 2025-10-28 at 00 02 52@2x" src="https://github.com/user-attachments/assets/042cefbc-93e9-47f6-ac59-adeb149b56b8" /> ## Testing Instructions (or ideally a Blueprint) Confirm the button is there and refreshes the page Co-authored-by: Claude <[email protected]>
1 parent 35f08a7 commit 4aaa448

File tree

4 files changed

+106
-0
lines changed

4 files changed

+106
-0
lines changed

packages/playground/website-extras/src/components/address-bar/index.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,38 @@ export default function AddressBar({ url, onUpdate }: AddressBarProps) {
2626
[onUpdate]
2727
);
2828

29+
const handleRefresh = useCallback(
30+
function (e: React.MouseEvent<HTMLButtonElement>) {
31+
e.preventDefault();
32+
if (url) {
33+
onUpdate?.(url);
34+
}
35+
},
36+
[url, onUpdate]
37+
);
38+
2939
return (
3040
<form className={css.form} onSubmit={handleSubmit}>
41+
<button
42+
type="button"
43+
className={css.refreshButton}
44+
onClick={handleRefresh}
45+
aria-label="Refresh page"
46+
title="Refresh page"
47+
>
48+
<svg
49+
width="16"
50+
height="16"
51+
viewBox="0 0 16 16"
52+
fill="none"
53+
xmlns="http://www.w3.org/2000/svg"
54+
>
55+
<path
56+
d="M13.65 2.35C12.2 0.9 10.21 0 8 0 3.58 0 0.01 3.58 0.01 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L9 7h7V0l-2.35 2.35z"
57+
fill="currentColor"
58+
/>
59+
</svg>
60+
</button>
3161
<div className={css.inputContainer}>
3262
<input
3363
ref={input}

packages/playground/website-extras/src/components/address-bar/style.module.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,29 @@
22
position: relative;
33
display: flex;
44
transition: opacity 0.5s ease;
5+
align-items: center;
6+
gap: 8px;
7+
}
8+
9+
.refresh-button {
10+
display: flex;
11+
align-items: center;
12+
justify-content: center;
13+
padding: 5px;
14+
background: transparent;
15+
border: none;
16+
color: #b4becb;
17+
cursor: pointer;
18+
transition: color 0.2s ease;
19+
flex-shrink: 0;
20+
}
21+
22+
.refresh-button:hover {
23+
color: #fff;
24+
}
25+
26+
.refresh-button:active {
27+
transform: scale(0.95);
528
}
629

730
.input-container {

packages/playground/website/src/components/address-bar/index.tsx

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,38 @@ export default function AddressBar({ url, onUpdate }: AddressBarProps) {
2626
[onUpdate]
2727
);
2828

29+
const handleRefresh = useCallback(
30+
function (e: React.MouseEvent<HTMLButtonElement>) {
31+
e.preventDefault();
32+
if (url) {
33+
onUpdate?.(url);
34+
}
35+
},
36+
[url, onUpdate]
37+
);
38+
2939
return (
3040
<form className={css.form} onSubmit={handleSubmit}>
41+
<button
42+
type="button"
43+
className={css.refreshButton}
44+
onClick={handleRefresh}
45+
aria-label="Refresh page"
46+
title="Refresh page"
47+
>
48+
<svg
49+
width="16"
50+
height="16"
51+
viewBox="0 0 16 16"
52+
fill="none"
53+
xmlns="http://www.w3.org/2000/svg"
54+
>
55+
<path
56+
d="M13.65 2.35C12.2 0.9 10.21 0 8 0 3.58 0 0.01 3.58 0.01 8s3.57 8 7.99 8c3.73 0 6.84-2.55 7.73-6h-2.08c-.82 2.33-3.04 4-5.65 4-3.31 0-6-2.69-6-6s2.69-6 6-6c1.66 0 3.14.69 4.22 1.78L9 7h7V0l-2.35 2.35z"
57+
fill="currentColor"
58+
/>
59+
</svg>
60+
</button>
3161
<div className={css.inputContainer}>
3262
<input
3363
ref={input}

packages/playground/website/src/components/address-bar/style.module.css

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,29 @@
33
display: flex;
44
transition: opacity 0.5s ease;
55
width: 100%;
6+
align-items: center;
7+
gap: 8px;
8+
}
9+
10+
.refresh-button {
11+
display: flex;
12+
align-items: center;
13+
justify-content: center;
14+
padding: 5px;
15+
background: transparent;
16+
border: none;
17+
color: #b4becb;
18+
cursor: pointer;
19+
transition: color 0.2s ease;
20+
flex-shrink: 0;
21+
}
22+
23+
.refresh-button:hover {
24+
color: #fff;
25+
}
26+
27+
.refresh-button:active {
28+
transform: scale(0.95);
629
}
730

831
.input-container {

0 commit comments

Comments
 (0)