Skip to content

Commit 5ec6904

Browse files
🔧 style: update base flow
1 parent e5ceac9 commit 5ec6904

File tree

22 files changed

+491
-228
lines changed

22 files changed

+491
-228
lines changed

‎package.json

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,14 +72,13 @@
7272
},
7373
"dependencies": {
7474
"@babel/runtime": "^7",
75-
"@lobehub/ui": "^1",
7675
"polished": "^4",
77-
"react-layout-kit": "^1",
78-
"svgo-browser": "^1"
76+
"react-layout-kit": "^1"
7977
},
8078
"devDependencies": {
8179
"@commitlint/cli": "^18",
8280
"@lobehub/lint": "latest",
81+
"@lobehub/ui": "^1",
8382
"@testing-library/react": "^14",
8483
"@types/pangu": "^4",
8584
"@types/query-string": "^6",
@@ -105,15 +104,15 @@
105104
"remark-cli": "^11",
106105
"semantic-release": "^21",
107106
"stylelint": "^15",
107+
"svgo-browser": "^1",
108108
"typescript": "^5",
109109
"vitest": "latest"
110110
},
111111
"peerDependencies": {
112-
"@lobehub/ui": ">=1",
113-
"antd-style": ">=3",
114112
"polished": ">=4",
115113
"react": ">=18",
116-
"react-dom": ">=18"
114+
"react-dom": ">=18",
115+
"react-layout-kit": ">=1"
117116
},
118117
"publishConfig": {
119118
"access": "public",

‎src/Editor/Preview.tsx

Lines changed: 0 additions & 71 deletions
This file was deleted.

‎src/Editor/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ group:
66
title: Edtior
77
---
88

9-
<code src="./index.tsx" nopadding></code>
9+
<code src="../components/Editor/index.tsx" inline></code>

‎src/Editor/index.tsx

Lines changed: 0 additions & 54 deletions
This file was deleted.

‎src/IconAvatar/index.tsx

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { memo } from 'react';
2+
import { Flexbox, type FlexboxProps } from 'react-layout-kit';
3+
4+
export interface IconAvatarProps extends FlexboxProps {
5+
background: string;
6+
shape?: 'circle' | 'square';
7+
size: number;
8+
}
9+
10+
const IconAvatar = memo<IconAvatarProps>(
11+
({ shape = 'circle', background, size, style, children }) => {
12+
return (
13+
<Flexbox
14+
align={'center'}
15+
flex={'none'}
16+
justify={'center'}
17+
style={{
18+
background,
19+
borderRadius: shape === 'circle' ? '50%' : Math.floor(size * 0.1),
20+
height: size,
21+
width: size,
22+
...style,
23+
}}
24+
>
25+
{children}
26+
</Flexbox>
27+
);
28+
},
29+
);
30+
31+
export default IconAvatar;

‎src/IconShowcase/index.tsx

Lines changed: 0 additions & 53 deletions
This file was deleted.

‎src/Zhipu/components/Avatar.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
1-
import { Avatar as A, type AvatarProps } from '@lobehub/ui';
21
import { readableColor } from 'polished';
32
import { memo } from 'react';
43

4+
import IconAvatar, { type IconAvatarProps } from '@/IconAvatar';
5+
56
import { COLOR_PRIMARY } from '../style';
67
import Mono from './Mono';
78

8-
const Avatar = memo<AvatarProps>(({ size = 64, style, ...rest }) => {
9+
const Avatar = memo<IconAvatarProps>(({ size = 64, style, background, ...rest }) => {
10+
const bg = background || COLOR_PRIMARY;
911
return (
10-
<A
11-
avatar={<Mono size={size * 0.75} />}
12-
background={COLOR_PRIMARY}
12+
<IconAvatar
13+
background={bg}
1314
size={size}
14-
style={{ color: readableColor(COLOR_PRIMARY), ...style }}
15+
style={{ color: readableColor(bg), ...style }}
1516
{...rest}
16-
/>
17+
>
18+
<Mono size={size * 0.75} />
19+
</IconAvatar>
1720
);
1821
});
1922

‎src/Zhipu/components/Text.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const Icon: IconType = forwardRef(({ size = '1em', style, ...rest }, ref) => {
99
fillRule="evenodd"
1010
height={size}
1111
ref={ref}
12-
style={{ flex: 'none', lineHeight: 1, ...style }}
12+
style={{ flex: 'none', lineHeight: 1, width: 'fit-content', ...style }}
1313
viewBox="0 0 86 24"
1414
xmlns="http://www.w3.org/2000/svg"
1515
{...rest}

‎src/Zhipu/demos/index.tsx

Lines changed: 0 additions & 24 deletions
This file was deleted.

‎src/Zhipu/index.md

Lines changed: 62 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,65 @@ nav: Components
33
group: Icons
44
---
55

6-
<code src="./demos/index.tsx"></code>
6+
## Icons
7+
8+
```tsx
9+
import { Zhipu } from '@lobehub/icons';
10+
import { Flexbox } from 'react-layout-kit';
11+
12+
export default () => (
13+
<Flexbox gap={16} horizontal>
14+
<Zhipu size={64} />
15+
<Zhipu.Color size={64} />
16+
</Flexbox>
17+
);
18+
```
19+
20+
## Text
21+
22+
```tsx
23+
import { Zhipu } from '@lobehub/icons';
24+
25+
export default () => <Zhipu.Text size={64} />;
26+
```
27+
28+
## Combine
29+
30+
```tsx
31+
import { Zhipu } from '@lobehub/icons';
32+
import { Flexbox } from 'react-layout-kit';
33+
34+
export default () => (
35+
<Flexbox gap={16}>
36+
<Zhipu.Combine size={64} type={'mono'} />
37+
<Zhipu.Combine size={64} />
38+
</Flexbox>
39+
);
40+
```
41+
42+
## Avatars
43+
44+
```tsx
45+
import { Zhipu } from '@lobehub/icons';
46+
import { Flexbox } from 'react-layout-kit';
47+
48+
export default () => (
49+
<Flexbox gap={16} horizontal>
50+
<Zhipu.Avatar size={64} />
51+
<Zhipu.Avatar size={64} shape={'square'} />
52+
</Flexbox>
53+
);
54+
```
55+
56+
## Colors
57+
58+
```tsx
59+
/**
60+
* inline: true
61+
*/
62+
import { Zhipu } from '@lobehub/icons';
63+
64+
import ColorPreview from '../components/ColorPreview';
65+
66+
export default () => <ColorPreview color={Zhipu.colorPrimary} />;
67+
```

0 commit comments

Comments
 (0)