Skip to content

Commit

Permalink
Merge pull request #81 from AElf-devops/feat/css-export
Browse files Browse the repository at this point in the history
remove ant-icon dependencies, add css exports
  • Loading branch information
Peterbjx authored Mar 18, 2024
2 parents 4a4586b + d970298 commit b91958d
Show file tree
Hide file tree
Showing 31 changed files with 435 additions and 638 deletions.
2 changes: 1 addition & 1 deletion packages/common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aelf-design/common",
"version": "1.0.0-alpha.3",
"version": "1.0.0-alpha.10",
"type": "module",
"main": "dist/esm/index.js",
"module": "dist/esm/index.js",
Expand Down
19 changes: 11 additions & 8 deletions packages/component/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
{
"name": "aelf-design",
"version": "1.0.0-alpha.3",
"version": "1.0.0-alpha.10",
"type": "module",
"main": "dist/esm/index.js",
"module": "dist/esm/index.js",
"typings": "dist/esm/index.d.ts",
"exports": {
"import": "./dist/esm/index.js",
"require": "./dist/lib/index.js",
"types": "./dist/esm/index.d.ts"
".": {
"import": "./dist/esm/index.js",
"require": "./dist/lib/index.js",
"types": "./dist/esm/index.d.ts"
},
"./css": "./dist/esm/styles/fonts.css"
},
"files": [
"dist",
Expand Down Expand Up @@ -48,13 +51,13 @@
"copy-to-clipboard": "^3.3.3",
"dayjs": "^1.11.10",
"lodash-es": "^4.17.21",
"swiper": "^11.0.5"
},
"devDependencies": {
"swiper": "^11.0.5",
"@aws-sdk/client-cognito-identity": "^3.410.0",
"@aws-sdk/client-s3": "^3.410.0",
"@aws-sdk/credential-provider-cognito-identity": "^3.410.0",
"@aws-sdk/lib-storage": "^3.412.0",
"@aws-sdk/lib-storage": "^3.412.0"
},
"devDependencies": {
"@types/react": "^18.2.45",
"@types/react-dom": "^18.2.18",
"antd-mobile": "^5.34.0",
Expand Down
4 changes: 2 additions & 2 deletions packages/component/src/Input/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
ClearIcon,
EyeInvisibleOutlinedIcon,
EyeTwoToneIcon,
IconColorProps,
IconProps,
} from '@aelf-design/internal-icons';
import { Input as AntdInput, InputProps } from 'antd';
import { Theme, useTheme } from 'antd-style';
Expand Down Expand Up @@ -84,7 +84,7 @@ function InputPassword({
}: InputPasswordProps) {
const { styles: st } = useStyles({ size });
const token = useTheme();
const iconProps: IconColorProps = {
const iconProps: IconProps = {
twoToneColor: [token?.colorBorder, token?.colorBorder],
hoverTwoToneColor: [token?.colorPrimaryHover, token?.colorPrimaryHover],
activeTwoToneColor: [token?.colorPrimaryActive, token?.colorPrimaryActive],
Expand Down
3 changes: 3 additions & 0 deletions packages/component/src/Input/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ const useStyles = createStyles(({ css, token, prefixCls }, { size }: { size: Inp
cursor: not-allowed;
}
}
& .${prefixCls}-input-password-icon {
cursor: pointer;
}
`,
};
});
Expand Down
2 changes: 1 addition & 1 deletion packages/component/src/Modal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ function Modal({ wrapClassName, width = 438, closeIcon = true, children, ...prop
closeIcon={
closeIcon ? (
<div className={styles.closeIconWrap}>
<CloseIcon color={token?.colorTextBase} width="16" height="16" />
<CloseIcon color={token?.colorTextBase} width="16px" height="16px" />
</div>
) : null
}
Expand Down
4 changes: 2 additions & 2 deletions packages/component/src/Upload/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ function UploadItemRender({
>
<ClearIcon
color={token.colorPrimary}
data-hovercolor={token.colorPrimaryHover}
data-activecolor={token.colorPrimaryActive}
hoverColor={token.colorPrimaryHover}
activeColor={token.colorPrimaryActive}
width={16}
height={16}
/>
Expand Down
Binary file removed packages/component/src/styles/Roboto-Bold.ttf
Binary file not shown.
Binary file removed packages/component/src/styles/Roboto-Medium.ttf
Binary file not shown.
16 changes: 1 addition & 15 deletions packages/component/src/styles/fonts.css
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@

@font-face {
font-family: 'RobotoRegular';
font-weight: 400;
src: url('./Roboto-Regular.ttf') format('truetype');
}

@font-face {
font-family: 'RobotoMedium';
font-weight: 400;
src: url('./Roboto-Medium.ttf') format('truetype');
}

@font-face {
font-family: 'RobotoBold';
font-weight: 400;
src: url('./Roboto-Bold.ttf') format('truetype');
}

}
9 changes: 4 additions & 5 deletions packages/internal-icons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aelf-design/internal-icons",
"version": "1.0.0-alpha.3",
"version": "1.0.0-alpha.10",
"type": "module",
"main": "dist/esm/index.js",
"module": "dist/esm/index.js",
Expand Down Expand Up @@ -40,9 +40,9 @@
"build": "father build"
},
"dependencies": {
"@ant-design/icons": "^5.2.6",
"@ant-design/cssinjs": "^1.18.2",
"classnames": "^2.3.2"
"classnames": "^2.3.2",
"antd-style": "^3.5.2"
},
"devDependencies": {
"@types/react": "^18.2.45",
Expand All @@ -52,8 +52,7 @@
"glob": "^10.3.10",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.3.3",
"antd-style": "^3.5.2"
"typescript": "^5.3.3"
},
"peerDependencies": {
"antd": ">=4.23.0 || >=5.0.0",
Expand Down
29 changes: 13 additions & 16 deletions packages/internal-icons/src/components/CircleClose.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import * as React from 'react';
import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon';

import type { IconColorProps } from '../hooks';
import { AelfIcon } from '../icon/AelfIcon';
import AelfSVGComponent from '../svgs/circle-close.svg';
import { type IconProps } from '../type';

const componentName = 'CircleCloseIcon';
export const CircleCloseIcon = React.forwardRef<HTMLSpanElement, IconBaseProps & IconColorProps>(
(props, ref) => {
return (
<AelfIcon
component={AelfSVGComponent}
componentName={componentName}
defaultWidth={16}
defaultHeight={16}
ref={ref}
{...props}
/>
);
},
);
export const CircleCloseIcon = React.forwardRef<HTMLSpanElement, IconProps>((props, ref) => {
return (
<AelfIcon
component={AelfSVGComponent}
componentName={componentName}
defaultWidth={16}
defaultHeight={16}
ref={ref}
{...props}
/>
);
});
CircleCloseIcon.displayName = componentName;
29 changes: 13 additions & 16 deletions packages/internal-icons/src/components/ClearIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import * as React from 'react';
import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon';

import { type IconColorProps } from '../hooks';
import { AelfIcon } from '../icon/AelfIcon';
import AelfSVGComponent from '../svgs/clear-icon.svg';
import { type IconProps } from '../type';

const componentName = 'ClearIcon';
export const ClearIcon = React.forwardRef<HTMLSpanElement, IconBaseProps & IconColorProps>(
(props, ref) => {
return (
<AelfIcon
component={AelfSVGComponent}
componentName={componentName}
defaultWidth={16}
defaultHeight={16}
ref={ref}
{...props}
/>
);
},
);
export const ClearIcon = React.forwardRef<HTMLSpanElement, IconProps>((props, ref) => {
return (
<AelfIcon
component={AelfSVGComponent}
componentName={componentName}
defaultWidth={16}
defaultHeight={16}
ref={ref}
{...props}
/>
);
});
ClearIcon.displayName = 'ClearIcon';
29 changes: 13 additions & 16 deletions packages/internal-icons/src/components/CloseIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import * as React from 'react';
import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon';

import type { IconColorProps } from '../hooks';
import { AelfIcon } from '../icon/AelfIcon';
import AelfSVGComponent from '../svgs/close.svg';
import { type IconProps } from '../type';

const componentName = 'CloseIcon';
export const CloseIcon = React.forwardRef<HTMLSpanElement, IconBaseProps & IconColorProps>(
(props, ref) => {
return (
<AelfIcon
component={AelfSVGComponent}
componentName={componentName}
defaultWidth={16}
defaultHeight={16}
ref={ref}
{...props}
/>
);
},
);
export const CloseIcon = React.forwardRef<HTMLSpanElement, IconProps>((props, ref) => {
return (
<AelfIcon
component={AelfSVGComponent}
componentName={componentName}
defaultWidth={16}
defaultHeight={16}
ref={ref}
{...props}
/>
);
});
CloseIcon.displayName = 'CloseIcon';
29 changes: 13 additions & 16 deletions packages/internal-icons/src/components/CopyIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import * as React from 'react';
import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon';

import type { IconColorProps } from '../hooks';
import { AelfIcon } from '../icon/AelfIcon';
import AelfSVGComponent from '../svgs/copy.svg';
import { type IconProps } from '../type';

const componentName = 'CopyIcon';
export const CopyIcon = React.forwardRef<HTMLSpanElement, IconBaseProps & IconColorProps>(
(props, ref) => {
return (
<AelfIcon
component={AelfSVGComponent}
componentName={componentName}
defaultWidth={16}
defaultHeight={16}
ref={ref}
{...props}
/>
);
},
);
export const CopyIcon = React.forwardRef<HTMLSpanElement, IconProps>((props, ref) => {
return (
<AelfIcon
component={AelfSVGComponent}
componentName={componentName}
defaultWidth={16}
defaultHeight={16}
ref={ref}
{...props}
/>
);
});
CopyIcon.displayName = componentName;
29 changes: 13 additions & 16 deletions packages/internal-icons/src/components/DownArrowIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
import * as React from 'react';
import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon';

import type { IconColorProps } from '../hooks';
import { AelfIcon } from '../icon/AelfIcon';
import AelfSVGComponent from '../svgs/downArrow.svg';
import { type IconProps } from '../type';

const componentName = 'DownArrowIcon';
export const DownArrowIcon = React.forwardRef<HTMLSpanElement, IconBaseProps & IconColorProps>(
(props, ref) => {
return (
<AelfIcon
component={AelfSVGComponent}
componentName={componentName}
defaultWidth={12}
defaultHeight={12}
ref={ref}
{...props}
/>
);
},
);
export const DownArrowIcon = React.forwardRef<HTMLSpanElement, IconProps>((props, ref) => {
return (
<AelfIcon
component={AelfSVGComponent}
componentName={componentName}
defaultWidth={12}
defaultHeight={12}
ref={ref}
{...props}
/>
);
});
DownArrowIcon.displayName = 'DownArrowIcon';
35 changes: 15 additions & 20 deletions packages/internal-icons/src/components/EyeInvisibleOutlinedIcon.tsx
Original file line number Diff line number Diff line change
@@ -1,27 +1,22 @@
import * as React from 'react';
import AntdIcon from '@ant-design/icons';
import { type IconBaseProps } from '@ant-design/icons/lib/components/Icon';
import { ConfigProvider } from 'antd';
import classnames from 'classnames';

import type { IconColorProps } from '../hooks';
import { AelfIcon } from '../icon/AelfIcon';
import AelfSVGComponent from '../svgs/eye-invisible.svg';
import { type IconProps } from '../type';

const componentName = 'EyeInvisibleOutlinedIcon';
export const EyeInvisibleOutlinedIcon = React.forwardRef<
HTMLSpanElement,
IconBaseProps & IconColorProps
>((props, ref) => {
return (
<AelfIcon
component={AelfSVGComponent}
componentName={componentName}
defaultWidth={18}
defaultHeight={18}
ref={ref}
{...props}
/>
);
});
export const EyeInvisibleOutlinedIcon = React.forwardRef<HTMLSpanElement, IconProps>(
(props, ref) => {
return (
<AelfIcon
component={AelfSVGComponent}
componentName={componentName}
defaultWidth={18}
defaultHeight={18}
ref={ref}
{...props}
/>
);
},
);
EyeInvisibleOutlinedIcon.displayName = componentName;
Loading

0 comments on commit b91958d

Please sign in to comment.