diff --git a/packages/design/src/card/demo/border-less.tsx b/packages/design/src/card/demo/border-less.tsx index 359b3111d..87e522032 100644 --- a/packages/design/src/card/demo/border-less.tsx +++ b/packages/design/src/card/demo/border-less.tsx @@ -6,15 +6,15 @@ const App: React.FC = () => { return (
-

Card content

-

Card content

-

Card content

+
Card content
+
Card content
+
Card content
); diff --git a/packages/design/src/card/demo/no-divider.tsx b/packages/design/src/card/demo/no-divider.tsx index d37c0be78..63814beb8 100644 --- a/packages/design/src/card/demo/no-divider.tsx +++ b/packages/design/src/card/demo/no-divider.tsx @@ -3,9 +3,9 @@ import React from 'react'; const App: React.FC = () => ( More} style={{ width: 300 }}> -

Card content

-

Card content

-

Card content

+
Card content
+
Card content
+
Card content
); diff --git a/packages/design/src/space/demo/vertical.tsx b/packages/design/src/space/demo/vertical.tsx index 15cbb94f8..51ecd6f7c 100644 --- a/packages/design/src/space/demo/vertical.tsx +++ b/packages/design/src/space/demo/vertical.tsx @@ -3,16 +3,16 @@ import React from 'react'; const App: React.FC = () => ( -

Card content

-

Card content

+
Card content
+
Card content
-

Card content

-

Card content

+
Card content
+
Card content
-

Card content

-

Card content

+
Card content
+
Card content
); diff --git a/packages/design/src/table/demo/card-table.tsx b/packages/design/src/table/demo/card-table.tsx index 8e68b6a47..0ba684bc3 100644 --- a/packages/design/src/table/demo/card-table.tsx +++ b/packages/design/src/table/demo/card-table.tsx @@ -51,7 +51,7 @@ const App: React.FC = () => { hasBorder ? {} : { - backgroundColor: token.colorFillContent, + backgroundColor: token.colorBgLayout, padding: '40px 24px', margin: '-40px -24px', } diff --git a/packages/design/src/table/demo/pro-card-table.tsx b/packages/design/src/table/demo/pro-card-table.tsx index 831ac6be9..ef3bb6639 100644 --- a/packages/design/src/table/demo/pro-card-table.tsx +++ b/packages/design/src/table/demo/pro-card-table.tsx @@ -51,7 +51,7 @@ const App: React.FC = () => { hasBorder ? {} : { - backgroundColor: token.colorFillContent, + backgroundColor: token.colorBgLayout, padding: '40px 24px', margin: '-40px -24px', } diff --git a/packages/ui/src/ProCard/demo/basic.tsx b/packages/ui/src/ProCard/demo/basic.tsx index 740bbdbc6..6c471d452 100644 --- a/packages/ui/src/ProCard/demo/basic.tsx +++ b/packages/ui/src/ProCard/demo/basic.tsx @@ -1,14 +1,25 @@ import React, { useState } from 'react'; -import { Form, Switch } from '@oceanbase/design'; +import { Form, Switch, theme } from '@oceanbase/design'; import { ProCard } from '@oceanbase/ui'; export default () => { + const { token } = theme.useToken(); + const [hasHeader, setHasHeader] = useState(true); const [headerBordered, setHeaderBordered] = useState(false); const [hasPadding, setHasPadding] = useState(true); const bodyStyle: React.CSSProperties = hasPadding ? {} : { padding: 0 }; return ( <>
+ + { + setHasHeader(value); + }} + /> + { @@ -42,24 +53,12 @@ export default () => {
Card content
-
Card content
-
Card content
-
Card content
-
- @@ -67,6 +66,27 @@ export default () => {
Card content
Card content
+
+ +
Card content
+
Card content
+
Card content
+
+
); }; diff --git a/packages/ui/src/ProCard/style/index.ts b/packages/ui/src/ProCard/style/index.ts index b5b7e2d72..7bbaf94c8 100644 --- a/packages/ui/src/ProCard/style/index.ts +++ b/packages/ui/src/ProCard/style/index.ts @@ -9,6 +9,25 @@ export const genProCardStyle: GenerateStyle = (token: OBToken): CSSObje const tabsComponentCls = `${antCls}-tabs`; const tabsPrefixCls = `${prefixCls}-tabs`; return { + // follow Card style + // need add `div` to make style work + [`div${componentCls}`]: { + borderRadius: token.borderRadiusLG, + }, + [`${componentCls}:not(${componentCls}-border)`]: { + boxShadow: + '0 1px 2px 0 rgba(0, 0, 0, 0.03),0 1px 6px -1px rgba(0, 0, 0, 0.02),0 2px 4px 0 rgba(0, 0, 0, 0.02)', + }, + [`${componentCls}:not(${componentCls}-size-small)`]: { + [`${componentCls}-body`]: { + paddingBlock: token.paddingLG, + }, + [`&${componentCls}-has-title${componentCls}-no-divider`]: { + [`${componentCls}-body`]: { + paddingBlockStart: token.padding, + }, + }, + }, // no body padding card [`${componentCls}${componentCls}-no-body-padding:not(${componentCls}-contain-tabs)`]: { [`${componentCls}-header`]: {