-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* chore: init * refactor: Use presets hooks * feat: preset style * chore: rm console * test: clean up * test: update cov * chore: CI update * chore: LGTM * test: fix part test * test: update snapshot * test: rewrite part of test * test: more test case
- Loading branch information
Showing
21 changed files
with
331 additions
and
218 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,5 @@ | ||
export default { | ||
cjs: 'babel', | ||
esm: { type: 'babel', importLibToEs: true }, | ||
preCommit: { | ||
eslint: true, | ||
prettier: true, | ||
}, | ||
runtimeHelpers: true, | ||
}; | ||
import { defineConfig } from 'father'; | ||
|
||
export default defineConfig({ | ||
plugins: ['@rc-component/father-plugin'], | ||
}); |
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
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,38 @@ | ||
import * as React from 'react'; | ||
import type { PresetDate } from './interface'; | ||
|
||
export interface PresetPanelProps<T> { | ||
prefixCls: string; | ||
presets: PresetDate<T>[]; | ||
onClick: (value: T) => void; | ||
onHover?: (value: T) => void; | ||
} | ||
|
||
export default function PresetPanel<T>(props: PresetPanelProps<T>) { | ||
const { prefixCls, presets, onClick, onHover } = props; | ||
|
||
if (!presets.length) { | ||
return null; | ||
} | ||
|
||
return ( | ||
<ul className={`${prefixCls}-presets`}> | ||
{presets.map(({ label, value }, index) => ( | ||
<li | ||
key={index} | ||
onClick={() => { | ||
onClick(value); | ||
}} | ||
onMouseEnter={() => { | ||
onHover?.(value); | ||
}} | ||
onMouseLeave={() => { | ||
onHover?.(null); | ||
}} | ||
> | ||
{label} | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
} |
Oops, something went wrong.