Skip to content

Commit

Permalink
Update style of trace details
Browse files Browse the repository at this point in the history
  • Loading branch information
carbonrobot committed Oct 25, 2023
1 parent 6067975 commit 27df8f0
Show file tree
Hide file tree
Showing 32 changed files with 240 additions and 1,168 deletions.
5 changes: 5 additions & 0 deletions .changeset/dull-pandas-exercise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@envyjs/webui': patch
---

Update style of trace detail
2 changes: 1 addition & 1 deletion packages/webui/src/components/Authorization.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export default function Authorization({ value }: AuthorizationProps) {
{type} {token}
</div>
<div className="flex items-center justify-end ml-auto">
<ChevronDown className="w-6 h-6" />
<ChevronDown className="w-4 h-4" />
</div>
</div>
);
Expand Down
21 changes: 21 additions & 0 deletions packages/webui/src/components/Badge.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import type { Meta, StoryObj } from '@storybook/react';

import Badge from './Badge';

const meta = {
title: 'Components/Badge',
component: Badge,
parameters: {
layout: 'centered',
},
} satisfies Meta<typeof Badge>;

export default meta;
type Story = StoryObj<typeof meta>;

export const Standard: Story = {
args: {
children: 'Label',
className: 'bg-gray-100',
},
};
14 changes: 14 additions & 0 deletions packages/webui/src/components/Badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { tw } from '@/utils';

export default function Badge({ className, children }: { className?: string; children: React.ReactNode }) {
return (
<span
className={tw(
'inline-flex items-center rounded-full bg-gray-400 px-3 py-1 text-sm font-medium text-white',
className,
)}
>
{children}
</span>
);
}
10 changes: 8 additions & 2 deletions packages/webui/src/components/Button.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,12 @@ const meta = {
layout: 'centered',
},
argTypes: {
type: {
options: ['standard', 'action', 'ghost', 'danger'],
size: {
options: ['small', 'standard', 'large'],
control: { type: 'select' },
},
border: {
options: ['standard', 'ghost'],
control: { type: 'select' },
},
},
Expand All @@ -22,5 +26,7 @@ type Story = StoryObj<typeof meta>;
export const Standard: Story = {
args: {
children: 'Standard Button',
size: 'standard',
border: 'standard',
},
};
15 changes: 12 additions & 3 deletions packages/webui/src/components/Button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,15 @@ import { MouseEvent, Ref, RefObject, forwardRef, useRef } from 'react';

import { tw } from '@/utils';

export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement>;
export type ButtonProps = React.ButtonHTMLAttributes<HTMLButtonElement> & {
size?: 'small' | 'standard' | 'large';
border?: 'standard' | 'ghost';
};

function Button({ onClick, className, children, ...props }: ButtonProps, ref: Ref<HTMLButtonElement>) {
function Button(
{ onClick, className, size = 'standard', border = 'standard', children, ...props }: ButtonProps,
ref: Ref<HTMLButtonElement>,
) {
const buttonRef = useRef<HTMLButtonElement>(null);
const finalRef = (ref || buttonRef) as RefObject<HTMLButtonElement>;

Expand All @@ -17,7 +23,10 @@ function Button({ onClick, className, children, ...props }: ButtonProps, ref: Re
<button
ref={finalRef}
className={tw(
'flex gap-2 items-center p-2 text-secondary bg-primary border border-solid border-primary rounded-md shadow-sm hover:bg-gray-50',
'p-2 text-secondary bg-primary border border-solid border-primary rounded-md shadow-sm hover:bg-gray-50',
border === 'ghost' && 'bg-transparent border-transparent shadow-none',
size === 'small' && 'text-sm h-7 p-1',
size === 'large' && 'h-10',
className,
)}
onClick={handleClick}
Expand Down
37 changes: 0 additions & 37 deletions packages/webui/src/components/DropDown.stories.tsx

This file was deleted.

Loading

0 comments on commit 27df8f0

Please sign in to comment.