File tree Expand file tree Collapse file tree 7 files changed +38
-0
lines changed Expand file tree Collapse file tree 7 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -872,6 +872,23 @@ class DemoContainer extends React.Component {
872872 </ div >
873873 ) }
874874 />
875+ < Documentation
876+ name = "Dense raised card"
877+ component = { (
878+ < div >
879+ < Card dense raised >
880+ < CardBody >
881+ < h4 > Dense raised card</ h4 >
882+ < p >
883+ Dense card content < br />
884+ and the other one.
885+ </ p >
886+ < Button clickHandler = { loggerClick } label = "Click" variant = "secondary" block />
887+ </ CardBody >
888+ </ Card >
889+ </ div >
890+ ) }
891+ />
875892 < Documentation
876893 name = "Disabled card"
877894 component = { (
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import styles from './Card.scss';
55export const Card = ( props ) => {
66 const {
77 children,
8+ dense,
89 disabled,
910 id,
1011 inList,
@@ -21,6 +22,11 @@ export const Card = (props) => {
2122 typeClass = styles . isTypeBordered ;
2223 }
2324
25+ let denseClass = '' ;
26+ if ( dense ) {
27+ denseClass = styles . isDense ;
28+ }
29+
2430 let disabledClass = '' ;
2531 if ( disabled ) {
2632 disabledClass = styles . isDisabled ;
@@ -41,6 +47,7 @@ export const Card = (props) => {
4147 className = { ( `
4248 ${ styles . root }
4349 ${ typeClass }
50+ ${ denseClass }
4451 ${ disabledClass }
4552 ${ inListClass }
4653 ${ raisedClass }
@@ -53,6 +60,7 @@ export const Card = (props) => {
5360} ;
5461
5562Card . defaultProps = {
63+ dense : false ,
5664 disabled : false ,
5765 id : undefined ,
5866 inList : false ,
@@ -65,6 +73,7 @@ Card.propTypes = {
6573 PropTypes . arrayOf ( PropTypes . node ) ,
6674 PropTypes . node ,
6775 ] ) . isRequired ,
76+ dense : PropTypes . bool ,
6877 disabled : PropTypes . bool ,
6978 id : PropTypes . string ,
7079 inList : PropTypes . bool ,
Original file line number Diff line number Diff line change 11@import ' mixins' ;
2+ @import ' theme' ;
23
34.root {
45 display : flex ;
4647.isRaised {
4748 box-shadow : map-get ($card-raised , box-shadow );
4849}
50+
51+ .isDense .body ,
52+ .isDense .footer {
53+ padding : $card-dense-padding ;
54+ }
Original file line number Diff line number Diff line change 11$card-padding : var (--rui-card-padding );
2+ $card-dense-padding : var (--rui-card-dense-padding );
23$card-background-color : var (--rui-card-background-color );
34$card-border-width : var (--rui-card-border-width );
45$card-border-radius : var (--rui-card-border-radius );
Original file line number Diff line number Diff line change @@ -30,6 +30,7 @@ describe('rendering', () => {
3030 it ( 'renders correctly with all props' , ( ) => {
3131 const tree = shallow (
3232 < Card
33+ dense
3334 disabled
3435 id = "custom-id"
3536 raised
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ exports[`rendering renders correctly disabled 1`] = `
1515<div
1616 className = " root
1717 isTypeFlat
18+
1819 isDisabled"
1920>
2021 <p >
@@ -40,6 +41,7 @@ exports[`rendering renders correctly raised 1`] = `
4041 isTypeFlat
4142
4243
44+
4345 isRaised"
4446>
4547 <p >
@@ -52,6 +54,7 @@ exports[`rendering renders correctly with all props 1`] = `
5254<div
5355 className = " root
5456 isTypeWarning
57+ isDense
5558 isDisabled
5659
5760 isRaised"
Original file line number Diff line number Diff line change 423423
424424 // Cards: common properties
425425 --rui-card-padding : var (--rui-offset-4 );
426+ --rui-card-dense-padding : var (--rui-offset-2 );
426427 --rui-card-border-width : var (--rui-border-width );
427428 --rui-card-border-radius : var (--rui-border-radius );
428429 --rui-card-background-color : var (--rui-color-white );
You can’t perform that action at this time.
0 commit comments