From ab17b9f2da1337f04bb15d79b1ff37f354092b9d Mon Sep 17 00:00:00 2001 From: Rupin Khandelwal Date: Tue, 4 Oct 2022 13:03:55 -0500 Subject: [PATCH 1/3] Fix - Grid and List Layout --- .../patterns/LibraryCards/LibraryGridCard.tsx | 370 +++++++++++++++--- .../templates/library/LibraryList.tsx | 3 +- 2 files changed, 312 insertions(+), 61 deletions(-) diff --git a/packages/web/components/patterns/LibraryCards/LibraryGridCard.tsx b/packages/web/components/patterns/LibraryCards/LibraryGridCard.tsx index 88b11e166..b52ebb69e 100644 --- a/packages/web/components/patterns/LibraryCards/LibraryGridCard.tsx +++ b/packages/web/components/patterns/LibraryCards/LibraryGridCard.tsx @@ -1,8 +1,11 @@ -import { VStack, HStack, SpanBox } from '../../elements/LayoutPrimitives' +import { Box, VStack, HStack, SpanBox } from '../../elements/LayoutPrimitives' import { StyledText } from '../../elements/StyledText' import { removeHTMLTags } from '../ArticleSubtitle' +import { MoreOptionsIcon } from '../../elements/images/MoreOptionsIcon' import { theme } from '../../tokens/stitches.config' +import { CardMenu } from '../CardMenu' import { LabelChip } from '../../elements/LabelChip' +import { ProgressBar } from '../../elements/ProgressBar' import type { LinkedItemCardProps } from './CardTypes' import { ProgressBarVertical } from '../../elements/ProgressBarVertical' @@ -16,62 +19,244 @@ const ellipsisText = { margin: 'auto 0', } +const cardTitleGridStyle = { + mt: '0', + mb: '0', + fontSize: '18px', + textAlign: 'left', + lineHeight: '1.25', + // whiteSpace: 'nowrap', + // textOverflow: 'ellipsis', + width: '100%', + // overflow: 'hidden', +} + +const cardTitleListStyle = { + ...ellipsisText, + fontSize: '14px', + fontWeight: '600', + textAlign: 'left', +} + export function LibraryGridCard(props: LinkedItemCardProps): JSX.Element { return ( - - - - - - {/* */} - {props.item.labels?.map(({ name, color }, index) => ( - - ))} - {/* */} - {props.item.description} - + <> + {props.layout !== 'GRID_LAYOUT' ? ( + // { + // props.handleAction('showDetail') + // }} + // > + // {/* {props.item.image && props.layout !== 'LIST_LAYOUT' && ( + // { + // ;(e.target as HTMLElement).style.display = 'none' + // }} + // /> + // )} */} + // + // + // + // { + // // This is here to prevent menu click events from bubbling + // // up and causing us to "click" on the link item. + // e.stopPropagation() + // }} + // > + // + // } + // actionHandler={props.handleAction} + // /> + // + // + // + // + // {props.item.author && ( + // {removeHTMLTags(props.item.author)} + // )} + // {props.originText && ( + // <> + // + // + // {props.originText} + // + // + // )} + // + // + // + // + // + // {props.item.description} + // + // + // + // {props.item.labels?.map(({ name, color }, index) => ( + // + // ))} + // + // + // + 'jjjjjjjjjjjj' + ) : ( + // )} - - {props.item.author && ( - {removeHTMLTags(props.item.author)} - )} - - - + + + + + {/* */} + {props.item.labels?.map(({ name, color }, index) => ( + + ))} + {/* */} + {props.item.description} + + + + {props.item.author && ( + {removeHTMLTags(props.item.author)} + )} + + + + )} + ) } @@ -79,19 +264,84 @@ type CardTitleProps = { title: string } -function CardTitle(props: CardTitleProps): JSX.Element { +function CardTitle( + props: CardTitleProps, + cardProps: LinkedItemCardProps +): JSX.Element { return ( {props.title} ) } + +// export function LibraryGridCard(props: LinkedItemCardProps): JSX.Element { +// return ( +// +// +// +// +// +// {/* */} +// {props.item.labels?.map(({ name, color }, index) => ( +// +// ))} +// {/* */} +// {props.item.description} +// + +// +// {props.item.author && ( +// {removeHTMLTags(props.item.author)} +// )} +// +// +// +// ) +// } + +// type CardTitleProps = { +// title: string +// } diff --git a/packages/web/components/templates/library/LibraryList.tsx b/packages/web/components/templates/library/LibraryList.tsx index d7ad55f3c..71c276e98 100644 --- a/packages/web/components/templates/library/LibraryList.tsx +++ b/packages/web/components/templates/library/LibraryList.tsx @@ -83,7 +83,8 @@ export function LibraryList(props: LibraryListProps): JSX.Element { > {viewerData?.me && ( { From b6173cdc2d230e96e1c093303eb34e736e152c33 Mon Sep 17 00:00:00 2001 From: Rupin Khandelwal Date: Thu, 6 Oct 2022 11:47:02 -0500 Subject: [PATCH 2/3] Fixed the problem about the layouts - Fresh look helps --- .../patterns/LibraryCards/LibraryGridCard.tsx | 424 ++++++++---------- .../templates/library/LibraryList.tsx | 3 +- 2 files changed, 180 insertions(+), 247 deletions(-) diff --git a/packages/web/components/patterns/LibraryCards/LibraryGridCard.tsx b/packages/web/components/patterns/LibraryCards/LibraryGridCard.tsx index b52ebb69e..ccc70ff39 100644 --- a/packages/web/components/patterns/LibraryCards/LibraryGridCard.tsx +++ b/packages/web/components/patterns/LibraryCards/LibraryGridCard.tsx @@ -38,167 +38,189 @@ const cardTitleListStyle = { textAlign: 'left', } +// Props +type CardTitleProps = { + title: string +} + +// Functions +function CardTitle( + props: CardTitleProps, + cardProps: LinkedItemCardProps +): JSX.Element { + return ( + + {props.title} + + ) +} + +// Component export function LibraryGridCard(props: LinkedItemCardProps): JSX.Element { return ( <> - {props.layout !== 'GRID_LAYOUT' ? ( - // { - // props.handleAction('showDetail') - // }} - // > - // {/* {props.item.image && props.layout !== 'LIST_LAYOUT' && ( - // { - // ;(e.target as HTMLElement).style.display = 'none' - // }} - // /> - // )} */} - // - // - // - // { - // // This is here to prevent menu click events from bubbling - // // up and causing us to "click" on the link item. - // e.stopPropagation() - // }} - // > - // - // } - // actionHandler={props.handleAction} - // /> - // - // - // - // - // {props.item.author && ( - // {removeHTMLTags(props.item.author)} - // )} - // {props.originText && ( - // <> - // - // - // {props.originText} - // - // - // )} - // - // - // - // - // - // {props.item.description} - // - // - // - // {props.item.labels?.map(({ name, color }, index) => ( - // - // ))} - // - // - // - 'jjjjjjjjjjjj' + {props.layout === 'GRID_LAYOUT' ? ( + { + props.handleAction('showDetail') + }} + > + {/* {props.item.image && props.layout !== 'LIST_LAYOUT' && ( + { + ;(e.target as HTMLElement).style.display = 'none' + }} + /> + )} */} + + + + { + // This is here to prevent menu click events from bubbling + // up and causing us to "click" on the link item. + e.stopPropagation() + }} + > + + } + actionHandler={props.handleAction} + /> + + + + + {props.item.author && ( + {removeHTMLTags(props.item.author)} + )} + {props.originText && ( + <> + + + {props.originText} + + + )} + + + + + + {props.item.description} + + + + {props.item.labels?.map(({ name, color }, index) => ( + + ))} + + + ) : ( - // )} - - // {props.layout === 'LIST_LAYOUT' && ( - {/* */} {props.item.labels?.map(({ name, color }, index) => ( ))} - {/* */} {props.item.description} @@ -259,89 +279,3 @@ export function LibraryGridCard(props: LinkedItemCardProps): JSX.Element { ) } - -type CardTitleProps = { - title: string -} - -function CardTitle( - props: CardTitleProps, - cardProps: LinkedItemCardProps -): JSX.Element { - return ( - - {props.title} - - ) -} - -// export function LibraryGridCard(props: LinkedItemCardProps): JSX.Element { -// return ( -// -// -// -// -// -// {/* */} -// {props.item.labels?.map(({ name, color }, index) => ( -// -// ))} -// {/* */} -// {props.item.description} -// - -// -// {props.item.author && ( -// {removeHTMLTags(props.item.author)} -// )} -// -// -// -// ) -// } - -// type CardTitleProps = { -// title: string -// } diff --git a/packages/web/components/templates/library/LibraryList.tsx b/packages/web/components/templates/library/LibraryList.tsx index 71c276e98..d7ad55f3c 100644 --- a/packages/web/components/templates/library/LibraryList.tsx +++ b/packages/web/components/templates/library/LibraryList.tsx @@ -83,8 +83,7 @@ export function LibraryList(props: LibraryListProps): JSX.Element { > {viewerData?.me && ( { From 5bc3dec953ecc5a8d18de5da2077ffba89e01860 Mon Sep 17 00:00:00 2001 From: Rupin Khandelwal Date: Thu, 6 Oct 2022 12:45:43 -0500 Subject: [PATCH 3/3] Fixed all the layouts and cleaned up CSS for grid --- .../elements/ProgressBarVertical.tsx | 1 + .../patterns/LibraryCards/LibraryGridCard.tsx | 78 ++++--------------- 2 files changed, 14 insertions(+), 65 deletions(-) diff --git a/packages/web/components/elements/ProgressBarVertical.tsx b/packages/web/components/elements/ProgressBarVertical.tsx index 9f87d789d..aaa451de7 100644 --- a/packages/web/components/elements/ProgressBarVertical.tsx +++ b/packages/web/components/elements/ProgressBarVertical.tsx @@ -17,6 +17,7 @@ export function ProgressBarVertical(props: ProgressBarVProps): JSX.Element { borderRadius: '$1', overflow: 'hidden', backgroundColor: props.backgroundColor, + mr: '12px', }} > + {props.title} ) @@ -72,14 +52,10 @@ export function LibraryGridCard(props: LinkedItemCardProps): JSX.Element { css={{ p: '12px', height: '100%', - // width: '100%', - // maxWidth: '100%', borderRadius: '8px', cursor: 'pointer', - // wordBreak: 'break-word', - // overflow: 'clip', border: '1px solid $libraryActiveMenuItem', - // position: 'relative', + mb: '15px', }} alignment="start" distribution="start" @@ -87,43 +63,26 @@ export function LibraryGridCard(props: LinkedItemCardProps): JSX.Element { props.handleAction('showDetail') }} > - {/* {props.item.image && props.layout !== 'LIST_LAYOUT' && ( - { - ;(e.target as HTMLElement).style.display = 'none' - }} - /> - )} */} { // This is here to prevent menu click events from bubbling // up and causing us to "click" on the link item. @@ -147,7 +106,7 @@ export function LibraryGridCard(props: LinkedItemCardProps): JSX.Element { {props.item.author && ( {removeHTMLTags(props.item.author)} @@ -176,28 +135,15 @@ export function LibraryGridCard(props: LinkedItemCardProps): JSX.Element { distribution="between" css={{ width: '100%', - pt: '$2', - px: '$1', - pr: '12px', - mt: '7px', - flexGrow: '1', + pr: '12px', + flexGrow: '1', }} > @@ -220,7 +166,9 @@ export function LibraryGridCard(props: LinkedItemCardProps): JSX.Element { } /> + ) : ( + // ELSE display List Layout