Skip to content

Commit b718fbe

Browse files
styles
1 parent 161ff7f commit b718fbe

File tree

2 files changed

+67
-6
lines changed

2 files changed

+67
-6
lines changed

editor-packages/editor-ui/icon-button.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@ import styled from "@emotion/styled";
44
export const IconButton = React.forwardRef(function (
55
{
66
children,
7+
title,
78
outline,
89
onClick,
910
disabled,
1011
...props
1112
}: React.PropsWithChildren<{
13+
title?: string;
1214
outline?: React.CSSProperties["outline"];
1315
onClick?: React.MouseEventHandler<HTMLButtonElement>;
1416
disabled?: boolean;
@@ -20,6 +22,7 @@ export const IconButton = React.forwardRef(function (
2022
ref={ref}
2123
onClick={onClick}
2224
disabled={disabled}
25+
title={title}
2326
{...props}
2427
style={{
2528
outline,

editor/pages/tests/reports/[key]/index.tsx

Lines changed: 64 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,33 @@ import Head from "next/head";
33
import { InferGetServerSidePropsType } from "next";
44
import styled from "@emotion/styled";
55
import { Client, NodeReportCoverage } from "@codetest/editor-client";
6-
import { CircleIcon } from "@radix-ui/react-icons";
7-
6+
import { CircleIcon, LightningBoltIcon, CodeIcon } from "@radix-ui/react-icons";
7+
import { IconButton } from "@code-editor/ui";
88
type P = InferGetServerSidePropsType<typeof getServerSideProps>;
99

10-
export default function ReportPage({ data }: P) {
10+
export default function ReportPage({ _key, data }: P) {
11+
const onRegenerate = () => {
12+
alert("regenerate (not implemented)");
13+
};
14+
1115
return (
1216
<>
1317
<Head>
1418
<title>Report Coverages - @codetest/reports</title>
1519
{/* */}
1620
</Head>
1721
<Main>
18-
<h1>
19-
<code>@codetest/reports</code>
20-
</h1>
22+
<header className="header">
23+
<span>
24+
<code>@codetest/reports</code>
25+
<h1>{_key}</h1>
26+
</span>
27+
<div>
28+
<IconButton title="regenerate" onClick={onRegenerate}>
29+
<LightningBoltIcon />
30+
</IconButton>
31+
</div>
32+
</header>
2133
{/* <code>
2234
<pre>{JSON.stringify(data, null, 2)}</pre>
2335
</code> */}
@@ -34,6 +46,7 @@ export default function ReportPage({ data }: P) {
3446
}
3547

3648
const Main = styled.main`
49+
color: white;
3750
font-family: monospace;
3851
width: 400px;
3952
margin: auto;
@@ -45,6 +58,23 @@ const Main = styled.main`
4558
gap: 16px;
4659
}
4760
61+
header.header {
62+
margin: 120px 0 40px 0;
63+
display: flex;
64+
align-items: center;
65+
justify-content: space-between;
66+
67+
h1 {
68+
margin: 0;
69+
}
70+
71+
.actions {
72+
display: flex;
73+
align-items: center;
74+
gap: 4px;
75+
}
76+
}
77+
4878
footer {
4979
height: 200px;
5080
}
@@ -53,13 +83,29 @@ const Main = styled.main`
5383
function Item({ id, a, b, diff, report }: NodeReportCoverage & { id: string }) {
5484
const [focus, setFocus] = React.useState<"a" | "b" | null>(null);
5585

86+
const onInspect = () => {
87+
alert("inspect (not implemented)");
88+
};
89+
90+
const onRegenerate = () => {
91+
alert("regenerate (not implemented)");
92+
};
93+
5694
return (
5795
<ItemContainer>
5896
<header>
5997
<p className="title">
6098
<CircleIcon />
6199
{id} {focus && <span>({focus})</span>}
62100
</p>
101+
<div className="actions">
102+
<IconButton title="inspect" onClick={onInspect}>
103+
<CodeIcon />
104+
</IconButton>
105+
<IconButton title="regenerate" onClick={onRegenerate}>
106+
<LightningBoltIcon />
107+
</IconButton>
108+
</div>
63109
</header>
64110
<div className="view" data-focus={focus}>
65111
<img className="a" src={a} alt="A" />
@@ -92,12 +138,23 @@ const ItemContainer = styled.div`
92138
height: 100%;
93139
94140
header {
141+
color: white;
142+
display: flex;
143+
flex-direction: row;
144+
align-items: center;
145+
justify-content: space-between;
95146
padding: 16px;
96147
.title {
97148
display: flex;
98149
align-items: center;
99150
gap: 8px;
100151
}
152+
153+
.actions {
154+
display: flex;
155+
align-items: center;
156+
gap: 4px;
157+
}
101158
}
102159
103160
.view {
@@ -173,6 +230,7 @@ export async function getServerSideProps(context: any) {
173230

174231
return {
175232
props: {
233+
_key: key,
176234
data,
177235
},
178236
};

0 commit comments

Comments
 (0)