Skip to content
This repository has been archived by the owner on Sep 26, 2024. It is now read-only.

Commit

Permalink
Hasan/Pr 00 table refactor (#5515)
Browse files Browse the repository at this point in the history
* fix: fixed table layout and typescript issue

* fix: added layout to faq table
  • Loading branch information
hasan-deriv authored Sep 1, 2023
1 parent 935feb1 commit 927c785
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/features/components/atoms/table/base/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { ClassProps } from 'features/types'

export interface TableProps<T, K extends keyof T> extends BoxProps, ClassProps {
striped?: boolean
layout?: 'fixed' | 'auto'
data: T[]
columns: Array<TableColumnType<T, K>>
}
Expand All @@ -16,6 +17,7 @@ function BaseTable<T, K extends keyof T>({
data,
columns,
striped,
layout,
className,
...rest
}: TableProps<T, K>) {
Expand All @@ -24,7 +26,7 @@ function BaseTable<T, K extends keyof T>({
className={dclsx('table-responsive', { ['table-striped']: striped }, className)}
{...rest}
>
<table className={dclsx('table')}>
<table className={dclsx('table', { [`table-layout-${layout}`]: layout })}>
<TableHeader columns={columns} />
<TableRow data={data} columns={columns} />
</table>
Expand Down
2 changes: 1 addition & 1 deletion src/features/components/atoms/table/shadow-table/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'
import BaseTable, { TableProps } from '../base'
import dclsx from 'features/utils/dclsx'

const ShadowTable = ({ className, ...rest }: TableProps) => {
function ShadowTable<T, K extends keyof T>({ className, ...rest }: TableProps<T, K>) {
return <BaseTable className={dclsx('table-shadow', 'padding-12x', className)} {...rest} />
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ const FAQCommercialPlan = () => {
data={data}
columns={column_data}
striped
layout="fixed"
className={commercial_table_faq}
/>
</Container.Fixed>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ const CommercialPlan = () => {
data={data}
columns={column_data}
striped
layout="fixed"
className={commercial_table}
/>
</Container.Fluid>
Expand Down
10 changes: 5 additions & 5 deletions src/features/styles/theme/table.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@
.table {
inline-size: 100%;
background-color: transparent;
th, td {
line-height: 1.8;
}
}
.table-layout-fixed {
table-layout: fixed;
}
.table-shadow {
Expand All @@ -29,9 +34,4 @@
background-color: $color-white-1;
}
}
}

th, td {
line-height: 1.8!important;

}

0 comments on commit 927c785

Please sign in to comment.