-
Notifications
You must be signed in to change notification settings - Fork 10
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
Table系のリニューアル #126
Table系のリニューアル #126
Conversation
memo
|
table-layout: auto; | ||
white-space: nowrap; |
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.
デフォルトだとtable-layout: fixed;
でwhite-space: normal;
だと思うのですが、理由があったりしますかね....?
特にwhite-space
の方は改行させるとき、使う側が明示的に<br />
を入れたりすると思うので、nowrap
でも良いのでは??と思っています。
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.
あーでもDSTのデータは長い文字列があるのか。。。
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.
枠名とかがめっちゃ長いんよねw
table-layout: fixed;
に関してはそうしないとwidthが聞かないはず
scrollableにする時は table-layout: auto;
でいいかな
なのでDataTable的に横をscrollableにするかどうかを選べると良さそう
verticalSpacing?: VerticalSpacing; | ||
fullWidth?: boolean; | ||
tableMaxHeight?: string; |
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.
verticalSpacing
→ cellの余白を3種類で定義fullWidth
→ top以外のborderおよびborder-radiusを出すか否かを制御tableMaxHeight
→ 文字通りテーブルのmaxHeightを定義。<th />
はデフォでsticky
<Styled.BorderContainer fullWidth={fullWidth}> | ||
{!!tabs && ( | ||
<TableTabs | ||
width={tabWidth} | ||
value={currentTabIndex} | ||
items={tabs.map((tab, index) => ({ | ||
label: tab.label, | ||
value: index, | ||
}))} | ||
onChange={onHandleTabChange} | ||
/> | ||
)} | ||
<Styled.TableContainer maxHeight={tableMaxHeight}> |
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.
変更量多く見えるけど
�- Styled.BorderContainer
Styled.TableContainer
が加わっただけ。
/* TODO: 他に透明度指定する方法を聞く */ | ||
box-shadow: 0 4px ${colors.basic[300]}3D; |
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.
hexToRgbaみたいな関数作ったのでそれ使ってもらえると!
& th { | ||
position: sticky; | ||
top: 0; | ||
} |
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.
デフォでsticky
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.
意図しないとこでstickになったりしないかな
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.
optionで渡す方が安全なきがする
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.
tableMaxHeight
propsを渡した時にstickyにするようにします!
& > thead > tr:first-of-type > th { | ||
&:first-of-type { | ||
border-top-left-radius: ${Radius.SMALL}; | ||
} | ||
&:last-of-type { | ||
border-top-right-radius: ${Radius.SMALL}; | ||
} | ||
} | ||
& > tbody > tr:last-of-type > td { | ||
&:first-of-type { | ||
border-bottom-left-radius: ${Radius.SMALL}; | ||
} | ||
&:last-of-type { | ||
border-bottom-right-radius: ${Radius.SMALL}; | ||
} | ||
} |
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.
角がはみ出ないようにするためのプロパティ。
padding: ${({ theme }) => theme.spacing}px | ||
${({ theme }) => theme.spacing * 2}px; | ||
/* TODO: 他に透明度指定する方法を聞く */ | ||
box-shadow: 0 4px ${colors.basic[300]}3D; |
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.
colors使わなくていいようにしたいな...
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.
適したpaletteがなくて、直接入れようという話をnoroさんとしたんですよねぇ...
paletteにプロパティを追加するor既存のプロパティを変えることができれば良いのですが、妙案あればぜひに。
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.
colors.basic[300]
が特に固定で書く回数多い気がするからどこかに入れれるといいね
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.
一応issued
#129
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.
ありがと!
{children} | ||
</Typography> | ||
{sortable && ( | ||
<Styled.IconContainer> | ||
<> | ||
<Spacer pl={0.5} /> |
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.
FragmentじゃなくてSpacerのchildrenに入れるのが良さそう
export type VerticalSpacing = "small" | "medium" | "large"; | ||
|
||
const verticalSpacingMap: { [key in VerticalSpacing]: string } = { | ||
small: "8px", |
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.
themeのspacingを使って定義して欲しい!
& th { | ||
position: sticky; | ||
top: 0; | ||
} |
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.
意図しないとこでstickになったりしないかな
& th { | ||
position: sticky; | ||
top: 0; | ||
} |
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.
optionで渡す方が安全なきがする
@@ -292,30 +321,6 @@ export const CustomCell: React.FunctionComponent = () => { | |||
); | |||
}; | |||
|
|||
export const WithStickyHeader = () => ( |
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.
デフォでstickyにしたからですね。
#126 (comment) をやるにあたってまた追加すると思います。
@@ -322,7 +322,7 @@ const DataTable = <T extends { id: number; selectDisabled?: boolean }>({ | |||
<Styled.TableContainer maxHeight={tableMaxHeight}> |
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.
なるほど
none
が初期値なのか
& > th { | ||
${({ isStickyHeader }) => | ||
isStickyHeader | ||
? ` |
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.
styled-componentsのcssを使って
isStickyHeader && css`` 的な感じで書くと良さそう
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.
そういえばそんなAPIありましたね。。
ちょっとみておきますー
@@ -6,11 +6,18 @@ import { Header } from "./Header"; | |||
import { Row } from "./Row"; | |||
import { Radius } from "../../../../styles"; | |||
|
|||
const Container = styled.table` | |||
type TableProps = { | |||
horizontalScrollable: boolean; |
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.
cssのとこ以外はLGMTです!
ref: https://github.com/voyagegroup/fluct_datastrap/issues/1752