Skip to content

Commit

Permalink
Make unit type display look better
Browse files Browse the repository at this point in the history
  • Loading branch information
michaeldickens committed Jul 22, 2024
1 parent ef8ab16 commit f8a27ba
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 2 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ const WithComment: FC<PropsWithChildren<WithCommentProps>> = ({
)}
>
<MarkdownViewer md={comment} textSize="sm" />
{unitType && (<MarkdownViewer md={unitType} textSize="sm" />)}
</div>
);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import clsx from "clsx";
import { FC } from "react";

type UnitTypeProps = {
unitType: string;
};

export const UnitType: FC<UnitTypeProps> = ({ unitType }) => {
return (
<div
className={clsx(
// Copilot auto-completed these classes but it looks pretty good
"text-xs font-medium text-gray-500",
"rounded-full px-2 py-0.5",
/* "bg-gray-100" */ // IMO looks better without background
)}
>
:: {unitType}
</div>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ import {
} from "../ViewerProvider.js";
import { Body } from "./Body.js";
import { Title } from "./Title.js";
import { UnitType } from "./UnitType.js";

const CommentIconForValue: FC<{ value: SqValueWithContext }> = ({ value }) => {
const comment = getValueComment(value);
Expand Down Expand Up @@ -207,6 +208,8 @@ export const ValueWithContextViewer: FC<Props> = ({
}}
/>

{unitType && (<UnitType {...{unitType}} />)}

{!isOpen && (
<div className="ml-2 text-sm text-blue-800">
<SquiggleValuePreview value={value} />
Expand Down

0 comments on commit f8a27ba

Please sign in to comment.