Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update style of trace details #154

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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