diff --git a/components/divider/__tests__/__snapshots__/demo-extend.test.ts.snap b/components/divider/__tests__/__snapshots__/demo-extend.test.ts.snap index aa54fa2d5f..563b0ba869 100644 --- a/components/divider/__tests__/__snapshots__/demo-extend.test.ts.snap +++ b/components/divider/__tests__/__snapshots__/demo-extend.test.ts.snap @@ -33,6 +33,21 @@ Array [ role="separator" style="height:60px;border-color:#7cb305" />, +
+ +
, ] `; diff --git a/components/divider/__tests__/__snapshots__/demo.test.ts.snap b/components/divider/__tests__/__snapshots__/demo.test.ts.snap index 8af60aeef2..72e62c4271 100644 --- a/components/divider/__tests__/__snapshots__/demo.test.ts.snap +++ b/components/divider/__tests__/__snapshots__/demo.test.ts.snap @@ -33,6 +33,21 @@ Array [ role="separator" style="height:60px;border-color:#7cb305" />, +
+ +
, ] `; diff --git a/components/divider/demo/customize-style.tsx b/components/divider/demo/customize-style.tsx index d537eb0b54..29621bb498 100644 --- a/components/divider/demo/customize-style.tsx +++ b/components/divider/demo/customize-style.tsx @@ -10,6 +10,12 @@ const App: React.FC = () => ( + +
+ + Text + +
); diff --git a/components/divider/style/index.tsx b/components/divider/style/index.tsx index 118cfaabfd..ae8beabca2 100644 --- a/components/divider/style/index.tsx +++ b/components/divider/style/index.tsx @@ -45,6 +45,7 @@ const genSharedDividerStyle: GenerateStyle = (token): CSSObject => '&-horizontal&-with-text': { display: 'flex', + alignItems: 'center', margin: `${token.dividerHorizontalWithTextGutterMargin}px 0`, color: token.colorTextHeading, fontWeight: 500, @@ -55,7 +56,6 @@ const genSharedDividerStyle: GenerateStyle = (token): CSSObject => '&::before, &::after': { position: 'relative', - top: '50%', width: '50%', borderBlockStart: `${lineWidth}px solid transparent`, // Chrome not accept `inherit` in `border-top` @@ -68,24 +68,20 @@ const genSharedDividerStyle: GenerateStyle = (token): CSSObject => '&-horizontal&-with-text-left': { '&::before': { - top: '50%', width: '5%', }, '&::after': { - top: '50%', width: '95%', }, }, '&-horizontal&-with-text-right': { '&::before': { - top: '50%', width: '95%', }, '&::after': { - top: '50%', width: '5%', }, },