Skip to content

Commit

Permalink
styles
Browse files Browse the repository at this point in the history
  • Loading branch information
softmarshmallow committed Jun 17, 2023
1 parent 161ff7f commit b718fbe
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 6 deletions.
3 changes: 3 additions & 0 deletions editor-packages/editor-ui/icon-button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import styled from "@emotion/styled";
export const IconButton = React.forwardRef(function (
{
children,
title,
outline,
onClick,
disabled,
...props
}: React.PropsWithChildren<{
title?: string;
outline?: React.CSSProperties["outline"];
onClick?: React.MouseEventHandler<HTMLButtonElement>;
disabled?: boolean;
Expand All @@ -20,6 +22,7 @@ export const IconButton = React.forwardRef(function (
ref={ref}
onClick={onClick}
disabled={disabled}
title={title}
{...props}
style={{
outline,
Expand Down
70 changes: 64 additions & 6 deletions editor/pages/tests/reports/[key]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,33 @@ import Head from "next/head";
import { InferGetServerSidePropsType } from "next";
import styled from "@emotion/styled";
import { Client, NodeReportCoverage } from "@codetest/editor-client";
import { CircleIcon } from "@radix-ui/react-icons";

import { CircleIcon, LightningBoltIcon, CodeIcon } from "@radix-ui/react-icons";
import { IconButton } from "@code-editor/ui";
type P = InferGetServerSidePropsType<typeof getServerSideProps>;

export default function ReportPage({ data }: P) {
export default function ReportPage({ _key, data }: P) {
const onRegenerate = () => {
alert("regenerate (not implemented)");
};

return (
<>
<Head>
<title>Report Coverages - @codetest/reports</title>
{/* */}
</Head>
<Main>
<h1>
<code>@codetest/reports</code>
</h1>
<header className="header">
<span>
<code>@codetest/reports</code>
<h1>{_key}</h1>
</span>
<div>
<IconButton title="regenerate" onClick={onRegenerate}>
<LightningBoltIcon />
</IconButton>
</div>
</header>
{/* <code>
<pre>{JSON.stringify(data, null, 2)}</pre>
</code> */}
Expand All @@ -34,6 +46,7 @@ export default function ReportPage({ data }: P) {
}

const Main = styled.main`
color: white;
font-family: monospace;
width: 400px;
margin: auto;
Expand All @@ -45,6 +58,23 @@ const Main = styled.main`
gap: 16px;
}
header.header {
margin: 120px 0 40px 0;
display: flex;
align-items: center;
justify-content: space-between;
h1 {
margin: 0;
}
.actions {
display: flex;
align-items: center;
gap: 4px;
}
}
footer {
height: 200px;
}
Expand All @@ -53,13 +83,29 @@ const Main = styled.main`
function Item({ id, a, b, diff, report }: NodeReportCoverage & { id: string }) {
const [focus, setFocus] = React.useState<"a" | "b" | null>(null);

const onInspect = () => {
alert("inspect (not implemented)");
};

const onRegenerate = () => {
alert("regenerate (not implemented)");
};

return (
<ItemContainer>
<header>
<p className="title">
<CircleIcon />
{id} {focus && <span>({focus})</span>}
</p>
<div className="actions">
<IconButton title="inspect" onClick={onInspect}>
<CodeIcon />
</IconButton>
<IconButton title="regenerate" onClick={onRegenerate}>
<LightningBoltIcon />
</IconButton>
</div>
</header>
<div className="view" data-focus={focus}>
<img className="a" src={a} alt="A" />
Expand Down Expand Up @@ -92,12 +138,23 @@ const ItemContainer = styled.div`
height: 100%;
header {
color: white;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
padding: 16px;
.title {
display: flex;
align-items: center;
gap: 8px;
}
.actions {
display: flex;
align-items: center;
gap: 4px;
}
}
.view {
Expand Down Expand Up @@ -173,6 +230,7 @@ export async function getServerSideProps(context: any) {

return {
props: {
_key: key,
data,
},
};
Expand Down

0 comments on commit b718fbe

Please sign in to comment.