-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #15 from BQXBQX/dev-bqx
Dev bqx
- Loading branch information
Showing
12 changed files
with
330 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
@mixin animation($type) { | ||
animation-name: #{$type}; | ||
animation-duration: 200ms; | ||
animation-timing-function: ease-in-out; | ||
animation-fill-mode: forwards; | ||
} | ||
.date-picker-button { | ||
display: flex; | ||
align-items: center; | ||
gap: 10px; | ||
color: var(--shadow-color) !important; | ||
transition: all 0.2s ease-in-out; | ||
padding: 10px 15px !important; | ||
width: 280px; | ||
&.select { | ||
color: var(--primary-color) !important; | ||
svg { | ||
fill: var(--primary-color) !important; | ||
} | ||
} | ||
svg { | ||
fill: var(--shadow-color); | ||
transition: all 0.2s ease-in-out; | ||
} | ||
&:hover { | ||
color: var(--primary-color) !important; | ||
svg { | ||
fill: var(--primary-color); | ||
} | ||
} | ||
} | ||
.calendar-container { | ||
position: absolute; | ||
margin-top: 5px; | ||
&.in { | ||
@include animation(in); | ||
} | ||
&.hide { | ||
@include animation(hide); | ||
} | ||
} | ||
|
||
@keyframes in { | ||
from { | ||
opacity: 0; | ||
} | ||
to { | ||
opacity: 1; | ||
} | ||
} | ||
|
||
@keyframes hide { | ||
from { | ||
opacity: 1; | ||
} | ||
to { | ||
opacity: 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
// eslint-disable-next-line @typescript-eslint/no-unused-vars | ||
import React from 'react'; | ||
import { DatePicker, type DatePickerProps } from './DatePicker'; | ||
|
||
const test = (value: Date) => { | ||
console.log('selectDate', value); | ||
}; | ||
|
||
function generateRandomDate() { | ||
const startTimestamp = new Date(2000, 0, 1).getTime(); // 开始日期的时间戳,这里设置为2000年1月1日 | ||
const endTimestamp = new Date().getTime(); // 当前日期的时间戳,作为结束日期 | ||
|
||
const randomTimestamp = Math.random() * (endTimestamp - startTimestamp) + startTimestamp; | ||
const randomDate = new Date(randomTimestamp); | ||
|
||
return randomDate; | ||
} | ||
|
||
const meta = { | ||
title: 'Components/DatePicker', | ||
component: DatePicker, | ||
parameters: { | ||
layout: 'centered', | ||
}, | ||
tags: ['autodocs'], | ||
argTypes: {}, | ||
} satisfies Meta<typeof DatePicker>; | ||
|
||
export default meta; | ||
|
||
type Story = StoryObj<typeof meta>; | ||
|
||
const defaultProps: DatePickerProps = { | ||
onchange: test, | ||
}; | ||
|
||
export const DefaultDatePicker: Story = { | ||
args: { | ||
...defaultProps, | ||
}, | ||
}; | ||
|
||
export const RandomDefaultDatePicker: Story = { | ||
args: { | ||
...defaultProps, | ||
defaultPickDate: new Date(), | ||
}, | ||
}; | ||
|
||
export const RandomDatePicker: Story = { | ||
args: { | ||
pickDate: generateRandomDate(), | ||
}, | ||
}; |
Oops, something went wrong.