Skip to content

Commit

Permalink
✨ feat: 移除 styled 的默认导出
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Feb 19, 2023
1 parent 6810d5c commit 9ced0aa
Show file tree
Hide file tree
Showing 16 changed files with 27 additions and 592 deletions.
579 changes: 3 additions & 576 deletions CHANGELOG.md

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default () => {
#### 场景二:使用 styled 搭配 Token 创建自定义样式的组件

```tsx | pure
import { styled } from 'antd-style';
import styled from '@emotion/styled';

const Card = styled.div<{ primary?: boolean }>`
border-radius: ${(p) => p.theme.borderRadiusLG}px;
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/ThemeProvider/style.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from '@emotion/styled';
import { Space } from 'antd';
import { styled } from 'antd-style';

export const Container = styled(Space)`
padding: 40px;
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/api/useResponsive/style.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from 'antd-style';
import styled from '@emotion/styled';

export const Container = styled.div`
background: ${({ theme }) => theme.colorBgLayout};
Expand Down
4 changes: 3 additions & 1 deletion docs/demos/cases/Typography/default.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
/**
* iframe: 500
*/
import styled from '@emotion/styled';
import { App } from 'antd';
import { styled, ThemeProvider } from 'antd-style';
import { ThemeProvider } from 'antd-style';

import { Flexbox } from 'react-layout-kit';

import { GroupCollapse, GroupTitle, SubTitle, Title } from '../../common/Typography';
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/common/Typography/ActionPanel.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from '@emotion/styled';
import { Space } from 'antd';
import { styled } from 'antd-style';

export const ActionPanel = styled(Space)`
.anticon {
Expand Down
3 changes: 2 additions & 1 deletion docs/demos/common/Typography/Avatar.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import styled from '@emotion/styled';
import { Avatar as A } from 'antd';
import { styled, useTheme } from 'antd-style';
import { useTheme } from 'antd-style';
import { FC } from 'react';

const AvatarText = styled.span`
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/common/Typography/GroupCollapse.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import styled from '@emotion/styled';
import { Collapse } from 'antd';
import { styled } from 'antd-style';
import { FC, PropsWithChildren } from 'react';

const CustomCollapse = styled(Collapse)`
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/common/Typography/GroupTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { styled } from 'antd-style';
import styled from '@emotion/styled';
import { FC } from 'react';

const T = styled.div`
Expand Down
2 changes: 1 addition & 1 deletion docs/demos/common/Typography/SubTitle.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { ReadOutlined } from '@ant-design/icons';
import styled from '@emotion/styled';
import { Row } from 'antd';
import { styled } from 'antd-style';
import { startCase } from 'lodash';
import { FC, ReactNode } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion docs/demos/common/Typography/Title.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { HomeOutlined } from '@ant-design/icons';
import styled from '@emotion/styled';
import { Col, Row } from 'antd';
import { styled } from 'antd-style';

import { ActionPanel } from './ActionPanel';
import Avatar from './Avatar';
Expand Down
7 changes: 7 additions & 0 deletions docs/demos/typings.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { Theme as AntdStyleTheme } from 'antd-style';

// 为 emotion 的 styled 注入 antd-style 的主题类型
declare module '@emotion/react' {
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface Theme extends AntdStyleTheme {}
}
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
"@emotion/css": "^11",
"@emotion/react": "^11",
"@emotion/serialize": "^1",
"@emotion/styled": "^11",
"@emotion/utils": "^1",
"use-merge-value": "^1"
},
Expand All @@ -83,6 +82,7 @@
"@commitlint/cli": "^17",
"@emotion/babel-plugin": "^11",
"@emotion/jest": "^11",
"@emotion/styled": "^11",
"@floating-ui/react": "^0.17",
"@react-three/fiber": "^8",
"@testing-library/jest-dom": "^5",
Expand Down
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
// 等应用层完成迁移后,移除该导出
export { default as styled } from '@emotion/styled';
export * from './factories/createStyles/types';
export * from './factories/createThemeProvider/type';
export * from './functions';
Expand Down
4 changes: 2 additions & 2 deletions tests/functions/styled.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from '@emotion/styled';
import { render } from '@testing-library/react';

import { styled, ThemeProvider } from 'antd-style';
import { ThemeProvider } from 'antd-style';

describe('styled', () => {
it('类型定义正常', () => {
Expand Down
2 changes: 1 addition & 1 deletion tests/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"compilerOptions": {
"baseUrl": ".",
"paths": {
"antd-style": ["../src"]
"antd-style": ["../es"]
}
}
}

0 comments on commit 9ced0aa

Please sign in to comment.