Skip to content

Commit

Permalink
refactor(Calendar): 重构Calendar 日历,移除Icon依赖 (#901,#845)
Browse files Browse the repository at this point in the history
  • Loading branch information
nullptr-z authored Aug 6, 2022
1 parent d4e707a commit fb96d53
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
7 changes: 4 additions & 3 deletions packages/react-calendar/src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React, { useEffect, useMemo, useState } from 'react';
import { DatePickerDay, DatePickerDayProps, DatePickerDayDateSource } from '@uiw/react-date-picker';
import Icon from '@uiw/react-icon';
import { IconStyleBase } from '@uiw/react-icon';
import { Down } from '@uiw/icons/lib/Down';
import formatter from '@uiw/formatter';
import { IProps } from '@uiw/utils';
import RenderDay from './DayLabel';
Expand Down Expand Up @@ -122,11 +123,11 @@ export default function Calendar(props: CalendarProps) {
const btngroup = useMemo(
() => (
<CalendarBtnGroupStyleWrap className={`${prefixCls}-btn-group`}>
<Icon type="down" onClick={() => handlePaging('prev')} />
<IconStyleBase as={Down} onClick={() => handlePaging('prev')} style={{ width: 18 }} />
<CalendarBtnStyleWrap className={`${prefixCls}-btn`} onClick={() => handlePaging('today')}>
{todayLabel}
</CalendarBtnStyleWrap>
<Icon type="down" onClick={() => handlePaging('next')} />
<IconStyleBase as={Down} onClick={() => handlePaging('next')} style={{ width: 18 }} />
</CalendarBtnGroupStyleWrap>
),
[prefixCls, todayLabel],
Expand Down
7 changes: 3 additions & 4 deletions packages/react-calendar/src/style/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { IconStyleBase } from '@uiw/react-icon';
import { ThemeVariantValueOptions, getThemeVariantValue } from '@uiw/utils';
import styled, { css } from 'styled-components';

Expand Down Expand Up @@ -27,8 +28,7 @@ export const CalendarBtnGroupStyleWrap = styled.div<CalendarBtnGroupStyleWrapPro
position: relative;
top: -3px;
}
& > .w-icon,
& > ${CalendarBtnStyleWrap} {
& > ${IconStyleBase}, & > ${CalendarBtnStyleWrap} {
cursor: pointer;
border-radius: 3px;
transition: all 0.3s;
Expand All @@ -39,8 +39,7 @@ export const CalendarBtnGroupStyleWrap = styled.div<CalendarBtnGroupStyleWrapPro
background-color: ${getThemeVariantValue(props, 'backgroundColorCalendarActive')};
}
}
& > .w-icon,
& > ${CalendarBtnStyleWrap} {
& > ${IconStyleBase}, & > ${CalendarBtnStyleWrap} {
vertical-align: middle;
margin-top: -6px;
> svg {
Expand Down
4 changes: 2 additions & 2 deletions packages/react-transfer/src/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ export const TransferChekedContentWrap = styled.div`
overflow-y: auto;
`;

interface TransferArrowProps extends ThemeVariantValueOptions {}
interface TransferArrowProps extends ThemeVariantValueOptions { }

export const TransferArrow = styled(IconStyleBase)<TransferArrowProps>`
export const TransferArrow = styled(IconStyleBase) <TransferArrowProps>`
transition: all 0.3s;
border-radius: 3px;
Expand Down

0 comments on commit fb96d53

Please sign in to comment.