2024-07-09 17:27:16 +08:00
|
|
|
import React, { useContext } from 'react';
|
2024-04-08 14:04:08 +08:00
|
|
|
import { Button, ConfigProvider, Space } from 'antd';
|
2024-07-09 17:27:16 +08:00
|
|
|
import { AntDesignOutlined } from '@ant-design/icons';
|
|
|
|
import { css } from '@emotion/css';
|
2024-04-07 19:14:56 +08:00
|
|
|
|
2024-07-09 17:27:16 +08:00
|
|
|
const App: React.FC = () => {
|
|
|
|
const { getPrefixCls } = useContext(ConfigProvider.ConfigContext);
|
|
|
|
const rootPrefixCls = getPrefixCls();
|
|
|
|
const linearGradientButton = css`
|
|
|
|
&.${rootPrefixCls}-btn-primary:not([disabled]):not(.${rootPrefixCls}-btn-dangerous) {
|
|
|
|
border-width: 0;
|
2023-12-01 23:25:46 +08:00
|
|
|
|
2024-07-09 17:27:16 +08:00
|
|
|
> span {
|
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
|
|
|
|
&::before {
|
|
|
|
content: '';
|
|
|
|
background: linear-gradient(135deg, #6253E1, #04BEFE);
|
|
|
|
position: absolute;
|
|
|
|
inset: 0;
|
|
|
|
opacity: 1;
|
|
|
|
transition: all 0.3s;
|
|
|
|
border-radius: inherit;
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover::before {
|
|
|
|
opacity: 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
`;
|
|
|
|
return (
|
2024-04-07 19:14:56 +08:00
|
|
|
<ConfigProvider
|
2024-07-09 17:27:16 +08:00
|
|
|
button={{
|
|
|
|
className: linearGradientButton,
|
2024-04-07 19:14:56 +08:00
|
|
|
}}
|
|
|
|
>
|
2024-07-09 17:27:16 +08:00
|
|
|
<Space>
|
|
|
|
<Button type="primary" size="large" icon={<AntDesignOutlined />}>
|
|
|
|
Gradient Button
|
|
|
|
</Button>
|
|
|
|
<Button size="large">Button</Button>
|
|
|
|
</Space>
|
2024-04-07 19:14:56 +08:00
|
|
|
</ConfigProvider>
|
2024-07-09 17:27:16 +08:00
|
|
|
);
|
|
|
|
};
|
2023-12-01 23:25:46 +08:00
|
|
|
|
|
|
|
export default App;
|