Skip to content

Commit

Permalink
💄 style: Update list item style
Browse files Browse the repository at this point in the history
  • Loading branch information
canisminor1990 committed Nov 26, 2024
1 parent 53a83be commit 613c42a
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 22 deletions.
13 changes: 10 additions & 3 deletions docs/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,12 @@ export default () => (
export default () => {
const theme = useTheme();
return (
<Center gap={48}>
<Center
gap={48}
style={{ maxWidth: 960, overflow: 'hidden', position: 'relative', width: '100%' }}
>
<Center>
<h2 style={{ fontSize: 20 }}>🤯 Start building your AIGC app now</h2>
<h2 style={{ fontSize: 20, textAlign: 'center' }}>Start building your AIGC app now</h2>
<Snippet language={'bash'}>{'$ bun add @lobehub/ui'}</Snippet>
<p style={{ color: theme.colorTextSecondary, textAlign: 'center' }}>
The Lobe UI components are developed based on{' '}
Expand All @@ -52,7 +55,11 @@ export default () => {
as the default css-in-js styling solution.
</p>
</Center>
<Highlighter language={'tsx'} style={{ width: '100%' }} type={'ghost'}>
<Highlighter
language={'tsx'}
style={{ background: theme.colorFillTertiary, width: '100%' }}
type={'ghost'}
>
{example}
</Highlighter>
<Features items={items} />
Expand Down
2 changes: 1 addition & 1 deletion src/Hero/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const Hero = memo<HeroProps>(({ title, description, actions, Link }) => {
const ButtonGroups = useCallback(
() =>
Boolean(actions?.length) && (
<Flexbox className={styles.actions} gap={24} horizontal justify={'center'}>
<Flexbox className={styles.actions} gap={16} horizontal justify={'center'}>
{actions!.map(({ text, link, openExternal, icon, type }, index) => {
// @ts-ignore
const ButtonIcon = icon === 'Github' ? <Icon icon={Github} /> : icon;
Expand Down
23 changes: 16 additions & 7 deletions src/List/ListItem/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use client';

import { Typography } from 'antd';
import { Loader2, MessageSquare } from 'lucide-react';
import { ReactNode, forwardRef } from 'react';
import { Flexbox, FlexboxProps } from 'react-layout-kit';
Expand All @@ -9,6 +10,8 @@ import Icon from '@/Icon';
import { useStyles } from './style';
import { getChatItemTime } from './time';

const { Title, Paragraph } = Typography;

export interface ListItemProps extends Omit<FlexboxProps, 'title'> {
actions?: ReactNode;
active?: boolean;
Expand Down Expand Up @@ -74,14 +77,20 @@ const ListItem = forwardRef<HTMLDivElement, ListItemProps>(
<div className={styles.triangle}></div>
</div>
)}
{avatar ?? <Icon icon={MessageSquare} style={{ marginTop: 4 }} />}

<Flexbox className={styles.content} gap={8}>
<Flexbox distribution={'space-between'} horizontal>
<div className={styles.title}>{title}</div>
<Flexbox align={'flex-start'} flex={1} gap={8} horizontal style={{ overflow: 'hidden' }}>
{avatar ?? <Icon icon={MessageSquare} style={{ marginTop: 4 }} />}
<Flexbox className={styles.content} gap={4}>
<Title className={styles.title} ellipsis={{ rows: 1 }} level={3}>
{title}
</Title>
{description && (
<Paragraph className={styles.desc} ellipsis={{ rows: 1 }}>
{description}
</Paragraph>
)}
{addon}
</Flexbox>
{description && <div className={styles.desc}>{description}</div>}
{addon}
</Flexbox>

{loading ? (
Expand All @@ -105,7 +114,7 @@ const ListItem = forwardRef<HTMLDivElement, ListItemProps>(
{date && (
<div
className={cx(styles.time, classNames?.time)}
style={showAction ? { display: 'none' } : {}}
style={showAction ? { opacity: 0 } : {}}
>
{getChatItemTime(date)}
</div>
Expand Down
17 changes: 6 additions & 11 deletions src/List/ListItem/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,12 @@ export const useStyles = createStyles(({ css, token }) => {
align-self: center;
`,
desc: css`
overflow: hidden;
width: 100%;
margin: 0 !important;
font-size: 12px;
line-height: 1;
line-height: 1.2 !important;
color: ${token.colorTextDescription};
text-overflow: ellipsis;
white-space: nowrap;
`,

pin: css`
Expand All @@ -64,15 +61,13 @@ export const useStyles = createStyles(({ css, token }) => {
`,

title: css`
overflow: hidden;
width: 100%;
margin: 0 !important;
font-size: 16px;
line-height: 1;
font-size: 14px !important;
font-weight: 500 !important;
line-height: 1.2 !important;
color: ${token.colorText};
text-overflow: ellipsis;
white-space: nowrap;
`,
triangle: css`
width: 10px;
Expand Down
2 changes: 2 additions & 0 deletions src/List/demos/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default () => {
actions: <ActionIcon icon={MoreHorizontalIcon} />,
active: false,
avatar: <Avatar avatar={'😊'} />,
date: Date.now(),
description: 'Description 1',
pin: true,
showAction: true,
Expand All @@ -19,6 +20,7 @@ export default () => {
actions: <ActionIcon icon={MoreHorizontalIcon} />,
active: false,
avatar: <Avatar avatar={'😊'} />,
date: Date.now(),
description: 'Description 2',
title: 'Item 2',
},
Expand Down

0 comments on commit 613c42a

Please sign in to comment.