react ant design radio group, 自定义modal样式,radio样式

需求:

modal 里面需要一个list 列表,列表有单选框,并且可以确认。

遇到的问题:自定义modal的样式,修改radio/ radio group 的样式

设计图如下:

代码:

 


  return (
    <Modal
      title="Duplicate to other organizations"
      open={isModalVisible}
      onOk={handleOk}
      onCancel={handleCancel}
      okText="Duplicate"
      cancelText="Cancel"
      okButtonProps={{
        style: {
          background: 'linear-gradient(110deg, #4729FF 45.39%, #287EFE 128.78%',
          height: '40px',
          padding: '0 16px',
        },
      }}
      cancelButtonProps={{
        style: {
          background: '#FFFFFF',
          border: '1px solid var(--main-color, #2857FE)',
          height: '40px',
          padding: '0 16px',
        },
      }}
      className={styles.modalStyle}
    >
      <Input placeholder="Search" prefix={<SearchOutlined />} onChange={handleSearch} />{' '}

      <Radio.Group
        onChange={handleRadioChange}
        value={selectedTenantId}
        style={{
          width: '100%',
          height: '500px',
          overflow: 'auto',
        }}
      >
        <List
          itemLayout="horizontal"
          dataSource={filteredListData}
          renderItem={(item) => (
            <List.Item>
              <label
                style={{
                  display: 'flex',
                  flexDirection: 'row-reverse',
                  justifyContent: 'flex-end',
                  width: '100%',
                }}
              >
                {item?.tenantName}
              </label>
              <Radio value={item?.tenantId}></Radio>
            </List.Item>
          )}
        />
      </Radio.Group>
    </Modal>
  );

自定义样式:

.modalStyle {
    overflow: hidden;
    width: 60% !important;
    :global {
        .ant-radio-wrapper .ant-radio {
            margin-left: 8px;
            margin-right: 0;
        }
        .ant-modal-header {
            display: flex;
            padding: 8px 0px;
            align-items: flex-start;
            gap: 10px;
            align-self: stretch;

            .ant-modal-title {
                color: #3B3B3B;

                font-family: Helvetica;
                font-size: 16px;
                font-style: normal;
                font-weight: 400;
                line-height: normal;
            }
        }

        .ant-modal-body {
            .ant-input-affix-wrapper {
                height: 40px;
            }
        }

        .ant-modal-content {}
    }

}

相关推荐

  1. css去掉input,textarea默认样式定义样式

    2024-03-22 10:30:03       64 阅读
  2. django中定义视图样式

    2024-03-22 10:30:03       52 阅读
  3. 【uniapp】定义步骤条样式

    2024-03-22 10:30:03       45 阅读

最近更新

  1. docker php8.1+nginx base 镜像 dockerfile 配置

    2024-03-22 10:30:03       98 阅读
  2. Could not load dynamic library ‘cudart64_100.dll‘

    2024-03-22 10:30:03       106 阅读
  3. 在Django里面运行非项目文件

    2024-03-22 10:30:03       87 阅读
  4. Python语言-面向对象

    2024-03-22 10:30:03       96 阅读

热门阅读

  1. 在Ubuntu 22.04上安装Jenkins

    2024-03-22 10:30:03       37 阅读
  2. leetcode排列硬币

    2024-03-22 10:30:03       40 阅读
  3. VTK----VTK的事件机制

    2024-03-22 10:30:03       39 阅读
  4. spark core之RDD简介

    2024-03-22 10:30:03       40 阅读
  5. 第二十六章 配置 Web Gateway 的默认参数

    2024-03-22 10:30:03       42 阅读
  6. 富格林:正规观念阻挠诱导被骗

    2024-03-22 10:30:03       48 阅读
  7. 低代码开发与物联网应用:重塑未来技术生态

    2024-03-22 10:30:03       45 阅读
  8. 大数据开发(Hive面试真题)

    2024-03-22 10:30:03       43 阅读
  9. Spring包扫描

    2024-03-22 10:30:03       36 阅读