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

[Table] head row padding bug #460

Closed
shijiatongxue opened this issue Dec 24, 2021 · 1 comment
Closed

[Table] head row padding bug #460

shijiatongxue opened this issue Dec 24, 2021 · 1 comment
Labels
bug Something isn't working

Comments

@shijiatongxue
Copy link
Collaborator

Which Component 出现bug的组件

  • Table

Table head row paddingY is not same with design draft

semi-ui version

  • latest

Expected result 期望的结果是什么

  • paddingY always 8px

Actual result 实际的结果是什么

head row paddingY

  • default: 8px
  • small: 8px
  • middle: 12px

Reproducible code 复现代码

import React from 'react';
import { Table } from '@douyinfe/semi-ui';

const { Column } = Table;

function App() {
    const [size, setSize] = useState('default');
    const data = [
        {
            key: '1',
            name: 'Semi Design 设计稿.fig',
            nameIconSrc: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/figma-icon.png',
            size: '2M',
            owner: '姜鹏志',
            updateTime: '2020-02-02 05:13',
            avatarBg: 'grey'
        },
        {
            key: '2',
            name: 'Semi Design 分享演示文稿',
            nameIconSrc: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/docs-icon.png',
            size: '2M',
            owner: '郝宣',
            updateTime: '2020-01-17 05:31',
            avatarBg: 'red'
        },
        {
            key: '3',
            name: '设计文档',
            nameIconSrc: 'https://lf3-static.bytednsdoc.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/docs-icon.png',
            size: '34KB',
            owner: 'Zoey Edwards',
            updateTime: '2020-01-26 11:01',
            avatarBg: 'light-blue'
        },
    ];

    const renderName = (text, record, index) => {
        return (
            <div>
                <Avatar size="small" shape="square" src={record.nameIconSrc} style={{ marginRight: 12 }}></Avatar>
                {text}
            </div>
        );
    };

    const renderOwner = (text, record, index) => {
        return (
            <div>
                <Avatar size="small" color={record.avatarBg} style={{ marginRight: 4 }}>
                    {typeof text === 'string' && text.slice(0, 1)}
                </Avatar>
                {text}
            </div>
        );
    };

    return (
        <>
            <Select label="size" value={size} onChange={v => setSize(v)}>
                <Option value="small">small</Option>
                <Option value="middle">middle</Option>
                <Option value="default">default</Option>
            </Select>
            <Table size={size} dataSource={data} pagination={false}>
                <Column title="标题" dataIndex="name" key="name" render={renderName} />
                <Column title="大小" dataIndex="size" key="size" />
                <Column title="所有者" dataIndex="owner" key="owner" render={renderOwner} />
                <Column title="更新时间" dataIndex="updateTime" key="updateTime" />
                <Column title="" dataIndex="operate" key="operate" />
            </Table>
        </>
    );
}

render(App);

Additional information 补充说明

  • 遇到这个bug的业务场景、上下文、或者你的需求场景
@shijiatongxue
Copy link
Collaborator Author

v2.2.1 fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant