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

feat: Update table headers styles #181

Merged
merged 2 commits into from
Sep 20, 2024
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
24 changes: 24 additions & 0 deletions src/components/Table.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { css } from '@emotion/react'
import { Table as RadixTable } from '@radix-ui/themes'
import { ComponentProps } from 'react'

function ColumnHeaderCell(
props: ComponentProps<typeof RadixTable.ColumnHeaderCell>
) {
return (
<RadixTable.ColumnHeaderCell
{...props}
css={css`
color: var(--gray-11);
font-size: 10px;
font-weight: 600;
text-transform: uppercase;
`}
Comment on lines +11 to +16
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

/>
)
}

export const Table = {
...RadixTable,
ColumnHeaderCell,
}
3 changes: 2 additions & 1 deletion src/components/WebLogView/Cookies.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Flex, Table } from '@radix-ui/themes'
import { Flex } from '@radix-ui/themes'

import { Cookie } from '@/types'
import { Table } from '@/components/Table'

export function Cookies({ cookies = [] }: { cookies?: Cookie[] }) {
if (!cookies.length) {
Expand Down
14 changes: 11 additions & 3 deletions src/components/WebLogView/Details.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,21 @@ function PaneContent({
return (
<Flex direction="column" height="100%">
<Box
p="2"
py="2"
px="4"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This aligns the pane title with the table header:
image

css={css`
background-color: var(--accent-3);
background-color: var(--gray-2);
flex-shrink: 0;
`}
>
<Heading size="2">{heading}</Heading>
<Heading
size="2"
css={css`
font-weight: 500;
`}
>
{heading}
</Heading>
</Box>
{children}
</Flex>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { safeJsonParse } from '@/utils/json'
import { Table } from '@radix-ui/themes'
import { Table } from '@/components/Table'

export function FormPayloadPreview({
payloadJsonString,
Expand Down
3 changes: 2 additions & 1 deletion src/components/WebLogView/RequestDetails/QueryParams.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Flex, Table } from '@radix-ui/themes'
import { Flex } from '@radix-ui/themes'

import { Request } from '@/types'
import { Table } from '@/components/Table'

export function QueryParams({ request }: { request: Request }) {
if (request.query.length === 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { Cookies } from '../Cookies'
import { Headers } from './Headers'
import { Payload } from './Payload'
import { QueryParams } from './QueryParams'
import { Box } from '@radix-ui/themes'

export function RequestDetails({ data }: { data: ProxyData }) {
return (
Expand All @@ -19,7 +20,9 @@ export function RequestDetails({ data }: { data: ProxyData }) {
</Tabs.List>

<Tabs.Content value="headers">
<Headers data={data} />
<Box p="2" height="100%">
<Headers data={data} />
</Box>
</Tabs.Content>

<Tabs.Content value="payload">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,7 @@ export function ResponseDetails({ data }: { data: ProxyData }) {
</Tabs.Content>
<Tabs.Content value="cookies">
<ScrollArea style={{ height: '100%' }}>
<Box p="2" height="100%">
<Cookies cookies={data.response?.cookies} />
</Box>
<Cookies cookies={data.response?.cookies} />
</ScrollArea>
</Tabs.Content>
</Tabs.Root>
Expand Down
7 changes: 6 additions & 1 deletion src/components/WebLogView/Row.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ export function Row({ data, isSelected, onSelectRequest }: RowProps) {
)

return (
<Table.Row onClick={() => onSelectRequest(data)}>
<Table.Row
onClick={() => onSelectRequest(data)}
css={{
backgroundColor: isSelected ? 'var(--accent-2)' : 'transparent',
}}
>
<Table.Cell
css={{
cursor: 'var(--cursor-button)',
Expand Down
5 changes: 3 additions & 2 deletions src/components/WebLogView/WebLogView.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { ReactNode } from 'react'
import { css } from '@emotion/react'
import { Flex, Text, Table, Box } from '@radix-ui/themes'
import { Flex, Text, Box } from '@radix-ui/themes'
import { isEmpty } from 'lodash-es'

import { Group as GroupType, ProxyData } from '@/types'
import { Row } from './Row'
import { Group } from './Group'
import grotIllustration from '@/assets/grot.svg'
import { ReactNode } from 'react'
import { Table } from '@/components/Table'

interface WebLogViewProps {
requests: ProxyData[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function GeneratorSidebar() {
color="var(--red-9)"
/>
)}
Script preview
Script
</Tabs.Trigger>
{hasPreview && (
<Tabs.Trigger value="rule-preview">Rule preview</Tabs.Trigger>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { Box, Button, Flex, Table } from '@radix-ui/themes'
import { Box, Button, Flex } from '@radix-ui/themes'

import { Stage } from './Stage'
import { LoadProfileExecutorOptions } from '@/types/testOptions'
import { useFormContext, useFieldArray } from 'react-hook-form'
import { Table } from '@/components/Table'

export function VUStages() {
const {
Expand Down
3 changes: 2 additions & 1 deletion src/views/Generator/TestOptions/VariablesEditor.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { useCallback, useEffect } from 'react'
import { TrashIcon } from '@radix-ui/react-icons'
import { Button, IconButton, Table, TextField } from '@radix-ui/themes'
import { Button, IconButton, TextField } from '@radix-ui/themes'
import { useGeneratorStore } from '@/store/generator'
import { useForm, useFieldArray } from 'react-hook-form'
import { TestData } from '@/types/testData'
import { zodResolver } from '@hookform/resolvers/zod'
import { TestDataSchema } from '@/schemas/testData'
import { FieldGroup } from '@/components/Form'
import { Table } from '@/components/Table'

export function VariablesEditor() {
const variables = useGeneratorStore((store) => store.variables)
Expand Down
3 changes: 2 additions & 1 deletion src/views/Validator/ChecksSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ import { CollapsibleSection } from '@/components/CollapsibleSection'
import { K6Check } from '@/types'
import { css } from '@emotion/react'
import { InfoCircledIcon } from '@radix-ui/react-icons'
import { Box, Callout, ScrollArea, Table } from '@radix-ui/themes'
import { Box, Callout, ScrollArea } from '@radix-ui/themes'
import { groupChecksByPath } from './ChecksSection.utils'
import { CheckRow } from './CheckRow'
import { useMemo } from 'react'
import { Table } from '@/components/Table'

interface ChecksSectionProps {
checks: K6Check[]
Expand Down
Loading