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

chore: cleanup LemonTable API #18862

Merged
merged 7 commits into from
Dec 6, 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
28 changes: 17 additions & 11 deletions frontend/src/lib/lemon-ui/LemonTable/LemonTable.scss
Original file line number Diff line number Diff line change
Expand Up @@ -60,20 +60,26 @@
border-radius: 0;
}

&--borderless-rows {
tr {
border: none !important;
}
}

&--stealth {
background: none;
border: none;
border-radius: 0;

.LemonTable__content > table > thead {
background: none;
border: none;
.LemonTable__content > table {
> thead {
border-bottom: none;

.posthog-3000 & {
background: none;
}
}

> thead,
> tbody {
> tr {
&:not(:first-child) {
border-top: none;
}
}
}
}
}

Expand Down
9 changes: 7 additions & 2 deletions frontend/src/lib/lemon-ui/LemonTable/LemonTable.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ const meta: Meta<typeof LemonTable> = {
title: 'Lemon UI/Lemon Table',
component: LemonTable,
tags: ['autodocs'],
parameters: {
testOptions: {
include3000: true,
},
},
}
export default meta

Expand Down Expand Up @@ -182,8 +187,8 @@ XSmall.args = { size: 'xs' }
export const Embedded: Story = BasicTemplate.bind({})
Embedded.args = { embedded: true }

export const BorderlessRows: Story = BasicTemplate.bind({})
BorderlessRows.args = { borderedRows: false }
export const Stealth: Story = BasicTemplate.bind({})
Stealth.args = { stealth: true }

export const Loading: Story = BasicTemplate.bind({})
Loading.args = { loading: true }
Expand Down
11 changes: 4 additions & 7 deletions frontend/src/lib/lemon-ui/LemonTable/LemonTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ export interface LemonTableProps<T extends Record<string, any>> {
inset?: boolean
/** An embedded table has no border around it and no background. This way it blends better into other components. */
embedded?: boolean
/** Whether inner table borders should be shown. **/
borderedRows?: boolean
/** Whether to hide the table background and inner borders. **/
stealth?: boolean
loading?: boolean
pagination?: PaginationAuto | PaginationManual
expandable?: ExpandableConfig<T>
Expand Down Expand Up @@ -82,7 +82,6 @@ export interface LemonTableProps<T extends Record<string, any>> {
className?: string
style?: React.CSSProperties
'data-attr'?: string
display?: 'stealth' | 'default'
/** Footer to be shown below the table. */
footer?: React.ReactNode
/** Whether the first column should always remain visible when scrolling horizontally. */
Expand All @@ -101,7 +100,7 @@ export function LemonTable<T extends Record<string, any>>({
size,
inset = false,
embedded = false,
borderedRows = true,
stealth = false,
loading,
pagination,
expandable,
Expand All @@ -118,7 +117,6 @@ export function LemonTable<T extends Record<string, any>>({
className,
style,
'data-attr': dataAttr,
display = 'default',
footer,
firstColumnSticky,
}: LemonTableProps<T>): JSX.Element {
Expand Down Expand Up @@ -222,8 +220,7 @@ export function LemonTable<T extends Record<string, any>>({
loading && 'LemonTable--loading',
embedded && 'LemonTable--embedded',
rowRibbonColor !== undefined && `LemonTable--with-ribbon`,
!borderedRows && 'LemonTable--borderless-rows',
display === 'stealth' && 'LemonTable--stealth',
stealth && 'LemonTable--stealth',
isScrollableLeft && 'scrollable--left',
isScrollableRight && 'scrollable--right',
className
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/scenes/billing/BillingProduct.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -503,10 +503,10 @@ export const BillingProduct = ({ product }: { product: BillingProductV2Type }):
{product.tiered && tableTierData ? (
<>
<LemonTable
borderedRows={false}
stealth
embedded
size="xs"
uppercaseHeader={false}
display="stealth"
columns={tableColumns}
dataSource={tableTierData}
/>
Expand All @@ -526,9 +526,9 @@ export const BillingProduct = ({ product }: { product: BillingProductV2Type }):
</>
) : (
<LemonTable
borderedRows={false}
stealth
embedded
size="xs"
display="stealth"
uppercaseHeader={false}
columns={[
{ title: '', dataIndex: 'name' },
Expand Down
Loading