Skip to content

Commit fe7ae10

Browse files
committed
Add classes to browser buttons
1 parent b9a2e6e commit fe7ae10

File tree

2 files changed

+34
-10
lines changed

2 files changed

+34
-10
lines changed

packages/mini-browser/src/buttons.tsx

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,38 @@
1-
import React from "react";
1+
import { useClasser } from "@code-hike/classer"
2+
import React from "react"
23

34
function Back() {
5+
const c = useClasser("ch-browser")
46
return (
57
<svg
68
fill="currentColor"
79
preserveAspectRatio="xMidYMid meet"
810
height="1em"
911
viewBox="13 10 14 23"
10-
style={{ marginLeft: "0.2em", marginRight: "1em", color: "#999" }}
12+
className={c("button", "back-button")}
1113
>
1214
<g>
1315
<path d="m26.5 12.1q0 0.3-0.2 0.6l-8.8 8.7 8.8 8.8q0.2 0.2 0.2 0.5t-0.2 0.5l-1.1 1.1q-0.3 0.3-0.6 0.3t-0.5-0.3l-10.4-10.4q-0.2-0.2-0.2-0.5t0.2-0.5l10.4-10.4q0.3-0.2 0.5-0.2t0.6 0.2l1.1 1.1q0.2 0.2 0.2 0.5z" />
1416
</g>
1517
</svg>
16-
);
18+
)
1719
}
1820

1921
function Forward() {
22+
const c = useClasser("ch-browser")
2023
return (
2124
<svg
2225
fill="currentColor"
2326
preserveAspectRatio="xMidYMid meet"
2427
height="1em"
2528
viewBox="13 10 14 23"
26-
style={{ marginRight: "1em", color: "#999" }}
29+
className={c("button", "forward-button")}
2730
>
2831
<g>
2932
<path d="m26.3 21.4q0 0.3-0.2 0.5l-10.4 10.4q-0.3 0.3-0.6 0.3t-0.5-0.3l-1.1-1.1q-0.2-0.2-0.2-0.5t0.2-0.5l8.8-8.8-8.8-8.7q-0.2-0.3-0.2-0.6t0.2-0.5l1.1-1.1q0.3-0.2 0.5-0.2t0.6 0.2l10.4 10.4q0.2 0.2 0.2 0.5z" />
3033
</g>
3134
</svg>
32-
);
35+
)
3336
}
3437

3538
function Refresh() {
@@ -43,13 +46,14 @@ function Refresh() {
4346
>
4447
<path d="M29.5 10.5l3.9-3.9v11.8H21.6L27 13c-1.8-1.8-4.3-3-7-3-5.5 0-10 4.5-10 10s4.5 10 10 10c4.4 0 8.1-2.7 9.5-6.6h3.4c-1.5 5.7-6.6 10-12.9 10-7.3 0-13.3-6.1-13.3-13.4S12.7 6.6 20 6.6c3.7 0 7 1.5 9.5 3.9z" />
4548
</svg>
46-
);
49+
)
4750
}
4851

4952
function Open({ href }: { href: string }) {
53+
const c = useClasser("ch-browser")
5054
return (
5155
<a
52-
style={{ margin: "0 1em 0 1em", color: "inherit" }}
56+
className={c("button", "open-button")}
5357
title="Open in new tab"
5458
href={href}
5559
target="_blank"
@@ -62,13 +66,13 @@ function Open({ href }: { href: string }) {
6266
viewBox="3 3 18 18"
6367
height="1em"
6468
width="1em"
65-
style={{ display: "block" }}
69+
className={c("open-icon")}
6670
xmlns="http://www.w3.org/2000/svg"
6771
>
6872
<path d="M19 19H5V5h7V3H5c-1.11 0-2 .9-2 2v14c0 1.1.89 2 2 2h14c1.1 0 2-.9 2-2v-7h-2v7zM14 3v2h3.59l-9.83 9.83 1.41 1.41L19 6.41V10h2V3h-7z"></path>
6973
</svg>
7074
</a>
71-
);
75+
)
7276
}
7377

74-
export { Back, Forward, Refresh, Open };
78+
export { Back, Forward, Refresh, Open }

packages/mini-browser/src/index.scss

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,23 @@
2222
padding: 0 10px;
2323
color: #544;
2424
}
25+
26+
.ch-browser-button {
27+
margin: 0 1em;
28+
color: #999;
29+
}
30+
31+
.ch-browser-back-button {
32+
margin-left: 0.2em;
33+
}
34+
35+
.ch-browser-forward-button {
36+
margin-left: 0;
37+
}
38+
39+
.ch-browser-open-button {
40+
color: inherit;
41+
}
42+
.ch-browser-open-icon {
43+
display: block;
44+
}

0 commit comments

Comments
 (0)