fix: Divider horizontal line align (#39339)

* fix: divider hor align

* test: Update snapshot
This commit is contained in:
二货爱吃白萝卜 2022-12-07 14:25:26 +08:00 committed by GitHub
parent a2305aa291
commit 37c83beeca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 37 additions and 5 deletions

View File

@ -33,6 +33,21 @@ Array [
role="separator"
style="height:60px;border-color:#7cb305"
/>,
<div
style="display:flex;flex-direction:column;height:50px;box-shadow:0 0 1px red"
>
<div
class="ant-divider ant-divider-horizontal ant-divider-with-text ant-divider-with-text-left"
role="separator"
style="background:rgba(0,255,0,0.05)"
>
<span
class="ant-divider-inner-text"
>
Text
</span>
</div>
</div>,
]
`;

View File

@ -33,6 +33,21 @@ Array [
role="separator"
style="height:60px;border-color:#7cb305"
/>,
<div
style="display:flex;flex-direction:column;height:50px;box-shadow:0 0 1px red"
>
<div
class="ant-divider ant-divider-horizontal ant-divider-with-text ant-divider-with-text-left"
role="separator"
style="background:rgba(0,255,0,0.05)"
>
<span
class="ant-divider-inner-text"
>
Text
</span>
</div>
</div>,
]
`;

View File

@ -10,6 +10,12 @@ const App: React.FC = () => (
</Divider>
<Divider type="vertical" style={{ height: 60, borderColor: '#7cb305' }} />
<Divider type="vertical" style={{ height: 60, borderColor: '#7cb305' }} dashed />
<div style={{ display: 'flex', flexDirection: 'column', height: 50, boxShadow: '0 0 1px red' }}>
<Divider style={{ background: 'rgba(0,255,0,0.05)' }} orientation="left">
Text
</Divider>
</div>
</>
);

View File

@ -45,6 +45,7 @@ const genSharedDividerStyle: GenerateStyle<DividerToken> = (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<DividerToken> = (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<DividerToken> = (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%',
},
},