Skip to content
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

docs(cell): 增加卡片类型的 demo #1639

Merged
merged 3 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 76 additions & 2 deletions src/packages/cell/demo.taro.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import React from 'react'
import { My, Right } from '@nutui/icons-react-taro'
import { My, Right, Star } from '@nutui/icons-react-taro'
import Taro, { redirectTo, navigateTo } from '@tarojs/taro'
import { useTranslate } from '@/sites/assets/locale/taro'
import { Switch, Cell } from '@/packages/nutui.react.taro'
import { Switch, Cell, Button } from '@/packages/nutui.react.taro'
import Header from '@/sites/components/header'
import '@/packages/cell/demo.scss'

Expand Down Expand Up @@ -176,6 +176,80 @@ const CellDemo = () => {
) => onJumpclick(event, '/pages/index/index')}
/>
</Cell.Group>

<Cell.Group>
<Cell
title={
<div style={{ display: 'flex', alignItems: 'flex-end' }}>
<span style={{ fontWeight: '500' }}>{translated.title}</span>
<span
style={{
color: '#8C8C8C',
fontSize: '10px',
marginLeft: '5px',
lineHeight: 1.5,
}}
>
{translated.title1}
</span>
</div>
}
extra={
<div style={{ display: 'flex', alignItems: 'center' }}>
More
<Right size={12} style={{ marginLeft: '5px' }} />
</div>
}
/>
<Cell>
<div style={{ minHeight: '50px' }}>{translated.content}</div>
</Cell>
<Cell
align="center"
title={
<div
style={{
color: '#8C8C8C',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

色值可以使用 primary 色

fontSize: '12px',
}}
>
{translated.title1}
</div>
}
extra={<Button type="primary">Action</Button>}
/>
</Cell.Group>

<Cell.Group>
<Cell
title={
<div style={{ display: 'flex', alignItems: 'center' }}>
<Star style={{ marginRight: '5px' }} /> {translated.title}
</div>
}
extra={<Right />}
/>
<Cell>
<div style={{ minHeight: '50px' }}>{translated.content}</div>
</Cell>
<Cell align="center" extra={<Button type="primary">Action</Button>} />
</Cell.Group>

<Cell.Group>
<Cell
title={
<div
style={{ display: 'flex', alignItems: 'center', color: 'blue' }}
>
{translated.title}
</div>
}
/>
<Cell>
<div style={{ color: '#26bf26' }}>{translated.content}</div>
</Cell>
</Cell.Group>

<Cell.Group
divider={false}
title={translated.title7}
Expand Down
77 changes: 76 additions & 1 deletion src/packages/cell/demo.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import React from 'react'
import { My, Right } from '@nutui/icons-react'
import { My, Right, Star } from '@nutui/icons-react'
import { useTranslate } from '../../sites/assets/locale'
import Cell from './index'
import { Switch } from '../switch/switch'
import { Button } from '../button/button'
import Toast from '../toast'
import './demo.scss'

Expand Down Expand Up @@ -171,6 +172,80 @@ const CellDemo = () => {
align="center"
/>
</Cell.Group>

<Cell.Group>
<Cell
title={
<div style={{ display: 'flex', alignItems: 'flex-end' }}>
<span style={{ fontWeight: '500' }}>{translated.title}</span>
<span
style={{
color: '#8C8C8C',
fontSize: '10px',
marginLeft: '5px',
lineHeight: 1.5,
}}
>
{translated.title1}
</span>
</div>
}
extra={
<div style={{ display: 'flex', alignItems: 'center' }}>
More
<Right width={12} height={12} style={{ marginLeft: '5px' }} />
</div>
}
/>
<Cell>
<div style={{ minHeight: '50px' }}>{translated.content}</div>
</Cell>
<Cell
align="center"
title={
<div
style={{
color: '#8C8C8C',
fontSize: '12px',
}}
>
{translated.title1}
</div>
}
extra={<Button type="primary">Action</Button>}
/>
</Cell.Group>

<Cell.Group>
<Cell
title={
<div style={{ display: 'flex', alignItems: 'center' }}>
<Star style={{ marginRight: '5px' }} /> {translated.title}
</div>
}
extra={<Right />}
/>
<Cell>
<div style={{ minHeight: '50px' }}>{translated.content}</div>
</Cell>
<Cell align="center" extra={<Button type="primary">Action</Button>} />
</Cell.Group>

<Cell.Group>
<Cell
title={
<div
style={{ display: 'flex', alignItems: 'center', color: 'blue' }}
>
{translated.title}
</div>
}
/>
<Cell>
<div style={{ color: '#26bf26' }}>{translated.content}</div>
</Cell>
</Cell.Group>

<Cell.Group
divider={false}
title={translated.title7}
Expand Down
143 changes: 110 additions & 33 deletions src/packages/cell/doc.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ import { Cell } from '@nutui/nutui-react'
const App = () => {
return (
<Cell>
<div>Customize Content</div>
<div>Customize Content</div>
</Cell>
)
}
Expand All @@ -77,16 +77,18 @@ import { My } from '@nutui/icons-react'
const App = () => {
return (
<Cell
title={
title={
<div style={{ display: 'inline-flex', alignItems: 'center' }}>
<My />
Title<span style={{ marginLeft: '5px' }}>Description</span>
<My />
Title<span style={{ marginLeft: '5px' }}>Description</span>
</div>
}
description={
<span>Description<b style={{ color: 'red' }}>1</b></span>
}
extra="extra"
}
description={
<span>
Description<b style={{ color: 'red' }}>1</b>
</span>
}
extra="extra"
/>
)
}
Expand Down Expand Up @@ -127,7 +129,7 @@ import { Cell } from '@nutui/nutui-react'

const App = () => {
return (
<Cell align="center" title="Title" description="Description" extra="Desc" />
<Cell align="center" title="Title" description="Description" extra="Desc" />
)
}
export default App
Expand All @@ -141,8 +143,8 @@ export default App

```tsx
import React from 'react'
import { Cell } from '@nutui/nutui-react'
import { Right } from '@nutui/icons-react'
import { Cell, Button } from '@nutui/nutui-react'
import { Right, Star } from '@nutui/icons-react'

const App = () => {
const onJumpclick = (
Expand All @@ -155,31 +157,106 @@ const App = () => {
}
}
return (
<>
<Cell.Group
title="Link | Cell.Group Usage"
extra="Usage nut-cell-group support title extra"
>
<Cell
lassName="nutui-cell--clickable"
title="Link Usage"
align="center"
extra={<Right />}
<Cell
lassName="nutui-cell--clickable"
title="Link Usage"
align="center"
extra={<Right />}
/>
<Cell
className="nutui-cell--clickable"
title="URL Jump"
extra={
<>
<span style={{ marginRight: '5px' }}>https://jd.com</span>
<Right />
<span style={{ marginRight: '5px' }}>https://jd.com</span>
<Right />
</>
}
align="center"
onClick={(
}
align="center"
onClick={(
event: React.MouseEvent<HTMLDivElement, globalThis.MouseEvent>
) => onJumpclick(event, 'https://jd.com')}
) => onJumpclick(event, 'https://jd.com')}
/>
</Cell.Group>

<Cell.Group>
<Cell
title={
<div style={{ display: 'flex', alignItems: 'flex-end' }}>
<span style={{ fontWeight: '500' }}>Title</span>
<span
style={{
color: '#8C8C8C',
fontSize: '10px',
marginLeft: '5px',
lineHeight: 1.5,
}}
>
Description
</span>
</div>
}
extra={
<div style={{ display: 'flex', alignItems: 'center' }}>
More
<Right width={12} height={12} style={{ marginLeft: '5px' }} />
</div>
}
/>
<Cell>
<div style={{ minHeight: '50px' }}>Content</div>
</Cell>
<Cell
align="center"
title={
<div
style={{
color: '#8C8C8C',
fontSize: '12px',
}}
>
Description
</div>
}
extra={<Button type="primary">Action</Button>}
/>
</Cell.Group>

<Cell.Group>
<Cell
title={
<div style={{ display: 'flex', alignItems: 'center' }}>
<Star style={{ marginRight: '5px' }} /> Title
</div>
}
extra={<Right />}
/>
<Cell>
<div style={{ minHeight: '50px' }}>Content</div>
</Cell>
<Cell align="center" extra={<Button type="primary">Action</Button>} />
</Cell.Group>

<Cell.Group>
<Cell
title={
<div
style={{ display: 'flex', alignItems: 'center', color: 'blue' }}
>
Title
</div>
}
/>
<Cell>
<div style={{ color: '#26bf26' }}>Content</div>
</Cell>
</Cell.Group>
</>
)
}
export default App
Expand All @@ -194,22 +271,22 @@ The 'divider' property allows you to keep the lower edge from being displayed be
:::demo

```tsx
import React from "react"
import React from 'react'
import { Cell } from '@nutui/nutui-react'

const App = () => {
return (
<Cell.Group
divider={false}
title="Grouping usage"
description="The bottom edge is not displayed between cells"
<Cell.Group
divider={false}
title="Grouping usage"
description="The bottom edge is not displayed between cells"
>
<Cell title="Title" extra="extra" />
<Cell title="Title" extra="extra" />
<Cell title="Title" extra="extra" />
<Cell title="Title" extra="extra" />
</Cell.Group>
);
};
export default App;
)
}
export default App
```

:::
Expand Down
Loading
Loading