Skip to content

Commit

Permalink
improve(ui): DateRanger border-radius style
Browse files Browse the repository at this point in the history
  • Loading branch information
dengfuping committed Dec 14, 2024
1 parent 9f10edc commit 6206ef7
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 12 deletions.
18 changes: 14 additions & 4 deletions packages/ui/src/DateRanger/Ranger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,11 @@ const Ranger = React.forwardRef((props: DateRangerProps, ref) => {
style={rest.style}
>
<Space size={0}>
<div className={`${prefix}-wrapper`}>
<div
className={classNames(`${prefix}-wrapper`, {
[`${prefix}-wrapper-has-jumper`]: hasRewind || hasForward,
})}
>
<Dropdown
trigger={['click']}
open={open}
Expand Down Expand Up @@ -452,7 +456,7 @@ const Ranger = React.forwardRef((props: DateRangerProps, ref) => {
>
{/* @ts-ignore */}
<DatePicker.RangePicker
className={`${prefix}-picker`}
className={classNames(`${prefix}-picker`)}
style={{
pointerEvents: 'none',
border: 0,
Expand Down Expand Up @@ -497,7 +501,8 @@ const Ranger = React.forwardRef((props: DateRangerProps, ref) => {
style={{
paddingInline: 8,
borderInlineStart: 0,
borderRadius: 0,
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0,
}}
onMouseEnter={() => setBackRadioFocused(true)}
onMouseLeave={() => setBackRadioFocused(false)}
Expand Down Expand Up @@ -526,7 +531,12 @@ const Ranger = React.forwardRef((props: DateRangerProps, ref) => {
>
<Radio.Button
value="stepForward"
style={{ paddingInline: 8 }}
style={{
paddingInline: 8,
borderInlineStart: 0,
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0,
}}
// disabled={isPlay}
onClick={() => {
if (startTime && endTime) {
Expand Down
8 changes: 3 additions & 5 deletions packages/ui/src/DateRanger/demo/updateCurrentTime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ type TimeRangeRef = {
export default () => {
const ref = useRef<TimeRangeRef>();
const [timeRange, setTimeRange] = useState([]);
const format = 'YYYY-MM-DD HH:mm:ss';
return (
<div>
<Flex gap="middle" align="center">
Expand All @@ -19,17 +20,14 @@ export default () => {
ref.current.updateCurrentTime();
}}
>
更新最新时间
从外部更新时间
</Button>
{timeRange.length && (
<span>
{`${dayjs(timeRange[0]).format('YYYY-MM-DD HH:mm:ss')} ~ ${dayjs(timeRange[1]).format(
'YYYY-MM-DD HH:mm:ss'
)}`}
{`${dayjs(timeRange[0]).format(format)} ~ ${dayjs(timeRange[1]).format(format)}`}
</span>
)}
</Flex>

<Divider children="preview" />
<DateRanger
ref={ref}
Expand Down
8 changes: 6 additions & 2 deletions packages/ui/src/DateRanger/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@

.@{prefix} {
cursor: pointer;
min-width: 1120px;

.@{prefix}-wrapper {
border: 1px solid @colorBorder;
border-radius: 4px 0 0 4px;
box-sizing: border-box;
display: flex;
border-radius: ~'@{borderRadius}px';
transition: all 0.2s cubic-bezier(0.645, 0.045, 0.355, 1);
// FIXED: 存在不生效情况
.@{prefix}-picker {
Expand All @@ -27,6 +26,11 @@
}
}

.@{prefix}-wrapper-has-jumper {
border-top-right-radius: 0px;
border-bottom-right-radius: 0px;
}

.@{prefix}-play {
padding: 4px 11px 4px;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/ui/src/DateRanger/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ nav:

<code src="./demo/default-value.tsx" title="指定默认值"></code>

<code src="./demo/updateCurrentTime.tsx" title="更新当前时间"></code>
<code src="./demo/updateCurrentTime.tsx" title="从外部更新时间"></code>

## API

Expand Down

0 comments on commit 6206ef7

Please sign in to comment.