Skip to content

Commit

Permalink
feat(Card): support rtl
Browse files Browse the repository at this point in the history
  • Loading branch information
见义 committed Feb 20, 2019
1 parent b97a049 commit 6dd0673
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/card/card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,8 @@ export default class Card extends React.Component {
showTitleBullet,
showHeadDivider,
children,
locale
locale,
rtl,
} = this.props;
const { needMore, expand } = this.state;

Expand All @@ -159,6 +160,8 @@ export default class Card extends React.Component {

const others = pickOthers(Object.keys(Card.propTypes), this.props);

others.dir = rtl ? 'rtl' : undefined;

const headExtra = extra ? <div className={`${prefix}card-extra`}>{extra}</div> : null;

return (
Expand Down
1 change: 1 addition & 0 deletions src/card/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
@import "scss/variable";
@import "scss/normalize";
@import "scss/mixin";
@import "scss/rtl.scss";

#{$card-prefix} {
@include box-sizing;
Expand Down
28 changes: 28 additions & 0 deletions src/card/scss/rtl.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
@import "./variable";

#{$card-prefix}[dir="rtl"] {
#{$card-prefix}-extra {
left: 0;
right: auto;
}

#{$card-prefix}-title {
&:before {
right: 0;
left: auto;
}
}

#{$card-prefix}-subtitle {
float: left;
padding-right: $card-sub-title-padding-left;
padding-left: 0;
}

#{$card-prefix}-head-show-bullet {
#{$card-prefix}-title {
padding-left: 0;
padding-right: $card-title-padding-left;
}
}
}

0 comments on commit 6dd0673

Please sign in to comment.