-
Notifications
You must be signed in to change notification settings - Fork 13
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
Add data table #281
Merged
Merged
Add data table #281
Changes from all commits
Commits
Show all changes
58 commits
Select commit
Hold shift + click to select a range
ad5802e
[BOOKINGSG-4436][BK] [DS] Table Component (Basic)
balakrishnan-s5 059d36d
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) props update
balakrishnan-s5 7bbeb21
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) props table update
balakrishnan-s5 2294a5a
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) with checkbox story
balakrishnan-s5 5507a6e
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) new stories added
balakrishnan-s5 80da80c
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) checkbox story updated
balakrishnan-s5 7e38a1a
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) new stories added
balakrishnan-s5 d74b7d5
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) new stories added
balakrishnan-s5 e21699d
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Loading stories added
balakrishnan-s5 bda1ffd
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 940efa5
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 de4f42f
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 9fe7d5d
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 3d385ec
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 1f6c557
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 1baaa18
Merge branch 'master' into add-data-table
balakrishnan-s5 7685633
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 1ebf30a
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 d5f5047
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 869f054
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 cdf0a2b
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) comments clean up
balakrishnan-s5 07aa23b
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) row padding updated
balakrishnan-s5 b1a76ff
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Custom Empty view a…
balakrishnan-s5 839ef68
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) action button props…
balakrishnan-s5 b504c3e
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Custom Empty image
balakrishnan-s5 1890535
Merge branch 'master' into add-data-table
balakrishnan-s5 bef4fcc
[BOOKINGSG-4436][BK] [DS] Table Component (Basic)
balakrishnan-s5 42db5d1
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) props update
balakrishnan-s5 449e6d7
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) props table update
balakrishnan-s5 8183bc3
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) with checkbox story
balakrishnan-s5 22492ab
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) new stories added
balakrishnan-s5 6d986c4
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) checkbox story updated
balakrishnan-s5 95d99ae
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) new stories added
balakrishnan-s5 c1d0505
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) new stories added
balakrishnan-s5 e8f9531
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Loading stories added
balakrishnan-s5 5853a5a
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 72e00ca
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 57ef9a6
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 6937428
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 887414b
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 cab1ac6
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 7526c4a
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 0dde103
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 2d5e622
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 12e725b
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Props updated
balakrishnan-s5 519d0e5
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) comments clean up
balakrishnan-s5 eb22a71
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) row padding updated
balakrishnan-s5 8babfc4
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Custom Empty view a…
balakrishnan-s5 aad2850
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) action button props…
balakrishnan-s5 c59e494
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Custom Empty image
balakrishnan-s5 edb4495
Merge branch 'add-data-table' of https://github.com/LifeSG/react-desi…
balakrishnan-s5 895f9a6
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Sort Indicator tag …
balakrishnan-s5 7de290e
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Custom Empty image
balakrishnan-s5 230ca9c
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Style Props fixes
balakrishnan-s5 e826241
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) Style Props fixes
balakrishnan-s5 3f9d32a
[BOOKINGSG-4436][BK] [DS] Table Component (Basic) PR comment fixes
balakrishnan-s5 a07ebad
[BOOKINGSG-4436][SR] Refactor code referencing PR comments
SasithaRajapakasha f06de25
[BOOKINGSG-4436][SR] Add right padding to last cell of the row
SasithaRajapakasha File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,137 @@ | ||
import styled, { css } from "styled-components"; | ||
import { Color } from "../color"; | ||
import { TextStyleHelper } from "../text"; | ||
|
||
// ============================================================================= | ||
// STYLE INTERFACE, transient props are denoted with $ | ||
// See more https://styled-components.com/docs/api#transient-props | ||
// ============================================================================= | ||
interface TableStyleProps { | ||
$addMarginToFirstColumn?: boolean; | ||
} | ||
interface HeaderCellProps { | ||
$clickable: boolean; | ||
$maxWidth?: string; | ||
} | ||
interface BodyRowProps { | ||
$alternating: boolean; | ||
$isSelected?: boolean; | ||
$isSelectable?: boolean; | ||
} | ||
interface BodyRowProps { | ||
$alternating: boolean; | ||
$isSelected?: boolean; | ||
$isSelectable?: boolean; | ||
} | ||
interface BodyCellProps { | ||
$width?: string; | ||
} | ||
// ============================================================================= | ||
// STYLES | ||
// ============================================================================= | ||
|
||
export const TableWrapper = styled.div` | ||
width: 100%; | ||
border: 0.125rem solid ${Color.Neutral[6]}; | ||
border-radius: 0.5rem 0.5rem 0 0; | ||
overflow: auto; | ||
`; | ||
|
||
export const Table = styled.table<TableStyleProps>` | ||
width: 100%; | ||
border-collapse: collapse; | ||
tr, | ||
td { | ||
padding: 1.5rem 0; | ||
} | ||
th:last-child, | ||
td:last-child { | ||
padding-right: 1.5rem; | ||
} | ||
${(props) => { | ||
if (props.$addMarginToFirstColumn) { | ||
return css` | ||
th:first-child, | ||
td:first-child { | ||
padding-left: 1.5rem; | ||
} | ||
`; | ||
} | ||
}} | ||
`; | ||
|
||
export const HeaderRow = styled.tr` | ||
background-color: #f5f5f5; | ||
height: 5rem; | ||
border-bottom: 0.125rem solid ${Color.Neutral[6]}; | ||
`; | ||
|
||
export const HeaderCell = styled.th<HeaderCellProps>` | ||
padding: 1rem 0; | ||
text-align: left; | ||
cursor: ${(props) => (props.$clickable ? "pointer" : "default")}; | ||
max-width: ${(props) => (props.$maxWidth ? props.$maxWidth : "auto")}; | ||
vertical-align: middle; | ||
${TextStyleHelper.getFontFamily("H5", "bold")} | ||
color: ${Color.Neutral[1]}; | ||
`; | ||
|
||
export const HeaderCellWrapper = styled.div` | ||
display: flex; | ||
flex-direction: row; | ||
align-items: center; | ||
|
||
svg { | ||
color: ${Color.Neutral[1]}; | ||
margin-left: 0.5rem; | ||
} | ||
`; | ||
|
||
export const BodyRow = styled.tr<BodyRowProps>` | ||
background-color: ${(props) => { | ||
if (props.$isSelected) { | ||
return css` | ||
${Color.Accent.Light[5]}; | ||
`; | ||
} else if (props.$alternating) { | ||
return css` | ||
${Color.Neutral[7]}; | ||
`; | ||
} else { | ||
return css` | ||
${Color.Neutral[8]}; | ||
`; | ||
} | ||
}}; | ||
border-top: 0.125rem solid ${Color.Neutral[6]}; | ||
&:hover { | ||
background-color: ${(props) => { | ||
if (!props.$isSelected && props.$isSelectable) { | ||
return css` | ||
${Color.Accent.Light[4]}; | ||
`; | ||
} | ||
}}; | ||
} | ||
&:first-child { | ||
border-top: none; | ||
} | ||
`; | ||
|
||
export const BodyCell = styled.td<BodyCellProps>` | ||
padding: 1.25rem 1rem; | ||
width: ${(props) => (props.$width ? props.$width : "auto")}; | ||
vertical-align: middle; | ||
`; | ||
|
||
export const CheckBoxWrapper = styled.div` | ||
display: flex; | ||
align-items: center; | ||
justify-content: center; | ||
`; | ||
|
||
export const LoaderWrapper = styled.div` | ||
display: flex; | ||
flex-direction: column; | ||
align-items: center; | ||
`; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screen.Recording.2023-08-22.at.9.31.51.AM.mov
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.