Skip to content

Commit

Permalink
feat(message): change the layout of the main text (#395)
Browse files Browse the repository at this point in the history
  • Loading branch information
a674125938 committed Apr 7, 2024
1 parent 9be05ce commit a3baa2a
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/components/Message/Message.jsx
Expand Up @@ -68,7 +68,7 @@ class Message extends Component {
<SvgIcon size="20px" type="cross" />
</CloseIconWrap>
)}
{title && <TitleWrap>{title}</TitleWrap>}
{title && (children ? <TitleWrap>{title}</TitleWrap> : <ContentWrap>{title}</ContentWrap>)}
{children && <ContentWrap>{children}</ContentWrap>}
{footer && <FooterWrap>{footer}</FooterWrap>}
</MessageWrap>
Expand Down
3 changes: 3 additions & 0 deletions src/components/Message/__demo__/title.jsx
Expand Up @@ -13,6 +13,9 @@ const Demo = () => {
<div className="demo-wrap">
<Message title="Message Title" />
</div>
<div className="demo-wrap">
<Message>this is a message</Message>
</div>
<Button
onClick={() =>
Message.message({ title: 'Message Title', children: 'this is a message' }, undefined, () =>
Expand Down
14 changes: 5 additions & 9 deletions src/components/Message/style/index.js
Expand Up @@ -104,7 +104,7 @@ export const TitleWrap = withProps({
word-break: break-all;
font-size: 14px;
color: ${DT.T_COLOR_TEXT_DEFAULT_DARK};
line-height: 22px;
line-height: 24px;
`;
})
);
Expand All @@ -121,9 +121,9 @@ export const ContentWrap = withProps({
padding-right: 36px;
padding-left: 44px;
word-break: break-all;
font-size: 12px;
color: ${DT.T_COLOR_TEXT_DEFAULT_LIGHT};
line-height: 18px;
font-size: 14px;
color: ${DT.T_COLOR_TEXT_DEFAULT_DARK};
line-height: 24px;
`;
})
);
Expand All @@ -132,7 +132,7 @@ export const FooterWrap = styled('div')`
text-align: right;
margin-right: 16px;
margin-left: 44px;
margin-top: 12px;
margin-top: 8px;
`;

export const MessageWrap = withProps({
Expand All @@ -155,10 +155,6 @@ export const MessageWrap = withProps({
background: ${DT.T_COLOR_BG_DEFAULT_BRIGHT};
box-shadow: ${DT.T_SHADOW_BLOCK_DEFAULT_LG};
position: relative;
.${titleCls}+.${contentCls} {
margin-top: 8px;
}
`;
})
);
Expand Down

0 comments on commit a3baa2a

Please sign in to comment.