Skip to content

Commit

Permalink
feat(react-core/card): added Card Components
Browse files Browse the repository at this point in the history
affects: @patternfly/react-core, @patternfly/react-docs

Added Card, CardHeader, CardBody, and CardFooter components

ISSUES CLOSED: patternfly#386
  • Loading branch information
dmiller9911 committed Jun 28, 2018
1 parent 0074044 commit b6f1b7a
Show file tree
Hide file tree
Showing 31 changed files with 378 additions and 132 deletions.
2 changes: 1 addition & 1 deletion packages/react-core/build/copyStyles.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const pfDir = dirname(

copySync(join(pfDir, 'assets/'), stylesDir);
const css = readFileSync(join(pfDir, 'patternfly.css'), 'utf8').replace(
/\/assets\//gi,
/\.?\/assets\//gi,
'./'
);
writeFileSync(join(stylesDir, 'patternfly.css'), css);
2 changes: 1 addition & 1 deletion packages/react-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"postbuild": "node ./build/copyStyles.js"
},
"devDependencies": {
"@patternfly/patternfly-next": "^1.0.4",
"@patternfly/patternfly-next": "1.0.5",
"fs-extra": "^6.0.1"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
exports[`action button 1`] = `
.pf-c-button.pf-m-action {
display: inline-block;
position: relative;
padding: 0.5rem 0.5rem 0.5rem 0.5rem;
font-size: 1rem;
font-weight: 400;
line-height: 1;
color: #292e34;
text-align: center;
white-space: nowrap;
background-color: transparent;
border: 0px;
border-radius: 30em;
box-shadow: none;
color: #292e34;
}
<button
Expand All @@ -30,17 +30,17 @@ exports[`action button 1`] = `
exports[`danger button 1`] = `
.pf-c-button.pf-m-danger {
display: inline-block;
position: relative;
padding: 0.25rem 1.5rem 0.25rem 1.5rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #ffffff;
text-align: center;
white-space: nowrap;
background-color: #a30000;
border: 0px;
border-radius: 30em;
box-shadow: inset 0 0 0 2px #a30000;
color: #ffffff;
}
<button
Expand All @@ -57,17 +57,17 @@ exports[`danger button 1`] = `
exports[`isBlock 1`] = `
.pf-c-button.pf-m-primary.pf-m-block {
display: block;
position: relative;
padding: 0.25rem 1.5rem 0.25rem 1.5rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #ffffff;
text-align: center;
white-space: nowrap;
background-color: #00659c;
border: 0px;
border-radius: 30em;
box-shadow: inset 0 0 0 2px #00659c;
color: #ffffff;
width: 100%;
}
Expand All @@ -84,17 +84,17 @@ exports[`isBlock 1`] = `
exports[`isDisabled 1`] = `
.pf-c-button.pf-m-primary.pf-m-disabled {
display: inline-block;
position: relative;
padding: 0.25rem 1.5rem 0.25rem 1.5rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #72767b;
text-align: center;
white-space: nowrap;
background-color: #00659c;
background-color: #d1d1d1;
border: 0px;
border-radius: 30em;
box-shadow: inset 0 0 0 1px undefined;
color: #ffffff;
pointer-events: none;
}
Expand All @@ -111,17 +111,17 @@ exports[`isDisabled 1`] = `
exports[`isFocus 1`] = `
.pf-c-button.pf-m-primary.pf-m-focus {
display: inline-block;
position: relative;
padding: 0.25rem 1.5rem 0.25rem 1.5rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #ffffff;
text-align: center;
white-space: nowrap;
background-color: #00659c;
border: 0px;
border-radius: 30em;
box-shadow: inset 0 0 0 2px #00659c;
color: #ffffff;
}
<button
Expand All @@ -137,17 +137,17 @@ exports[`isFocus 1`] = `
exports[`isHover 1`] = `
.pf-c-button.pf-m-primary.pf-m-hover {
display: inline-block;
position: relative;
padding: 0.25rem 1.5rem 0.25rem 1.5rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #ffffff;
text-align: center;
white-space: nowrap;
background-color: #00659c;
border: 0px;
border-radius: 30em;
box-shadow: inset 0 0 0 2px #00659c;
color: #ffffff;
}
<button
Expand All @@ -163,17 +163,17 @@ exports[`isHover 1`] = `
exports[`link button 1`] = `
.pf-c-button.pf-m-link {
display: inline-block;
position: relative;
padding: 0.25rem 0.25rem 0.25rem 0.25rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #00486e;
text-align: center;
white-space: nowrap;
background-color: transparent;
border: 0px;
border-radius: 30em;
box-shadow: none;
color: #00486e;
}
<button
Expand All @@ -190,17 +190,17 @@ exports[`link button 1`] = `
exports[`primary button 1`] = `
.pf-c-button.pf-m-primary {
display: inline-block;
position: relative;
padding: 0.25rem 1.5rem 0.25rem 1.5rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #ffffff;
text-align: center;
white-space: nowrap;
background-color: #00659c;
border: 0px;
border-radius: 30em;
box-shadow: inset 0 0 0 2px #00659c;
color: #ffffff;
}
<button
Expand All @@ -217,17 +217,17 @@ exports[`primary button 1`] = `
exports[`secondary button 1`] = `
.pf-c-button.pf-m-secondary {
display: inline-block;
position: relative;
padding: 0.25rem 1.5rem 0.25rem 1.5rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #00659c;
text-align: center;
white-space: nowrap;
background-color: transparent;
border: 0px;
border-radius: 30em;
box-shadow: inset 0 0 0 2px #00659c;
color: #00659c;
}
<button
Expand All @@ -244,17 +244,17 @@ exports[`secondary button 1`] = `
exports[`tertiary button 1`] = `
.pf-c-button.pf-m-tertiary {
display: inline-block;
position: relative;
padding: 0.25rem 1.5rem 0.25rem 1.5rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #292e34;
text-align: center;
white-space: nowrap;
background-color: transparent;
border: 0px;
border-radius: 30em;
box-shadow: inset 0 0 0 2px #72767b;
color: #00659c;
}
<button
Expand Down
7 changes: 7 additions & 0 deletions packages/react-core/src/components/Card/Card.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { SFC, HTMLProps } from 'react';

export interface CardProps extends HTMLProps<HTMLDivElement> {}

declare const Card: SFC<CardProps>;

export default Card;
25 changes: 25 additions & 0 deletions packages/react-core/src/components/Card/Card.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/patternfly-next/components/Card/styles.css';

const propTypes = {
children: PropTypes.any,
className: PropTypes.string
};

const defaultProps = {
children: null,
className: ''
};

const Card = ({ children, className, ...props }) => (
<div className={css(styles.card, className)} {...props}>
{children}
</div>
);

Card.propTypes = propTypes;
Card.defaultProps = defaultProps;

export default Card;
7 changes: 7 additions & 0 deletions packages/react-core/src/components/Card/CardBody.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { SFC, HTMLProps } from 'react';

export interface CardBodyProps extends HTMLProps<HTMLDivElement> {}

declare const CardBody: SFC<CardBodyProps>;

export default CardBody;
25 changes: 25 additions & 0 deletions packages/react-core/src/components/Card/CardBody.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/patternfly-next/components/Card/styles.css';

const propTypes = {
children: PropTypes.any,
className: PropTypes.string
};

const defaultProps = {
children: null,
className: ''
};

const CardBody = ({ children, className, ...props }) => (
<div className={css(styles.cardBody, className)} {...props}>
{children}
</div>
);

CardBody.propTypes = propTypes;
CardBody.defaultProps = defaultProps;

export default CardBody;
7 changes: 7 additions & 0 deletions packages/react-core/src/components/Card/CardFooter.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { SFC, HTMLProps } from 'react';

export interface CardFooterProps extends HTMLProps<HTMLDivElement> {}

declare const CardFooter: SFC<CardFooterProps>;

export default CardFooter;
25 changes: 25 additions & 0 deletions packages/react-core/src/components/Card/CardFooter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/patternfly-next/components/Card/styles.css';

const propTypes = {
children: PropTypes.any,
className: PropTypes.string
};

const defaultProps = {
children: null,
className: ''
};

const CardFooter = ({ children, className, ...props }) => (
<div className={css(styles.cardFooter, className)} {...props}>
{children}
</div>
);

CardFooter.propTypes = propTypes;
CardFooter.defaultProps = defaultProps;

export default CardFooter;
7 changes: 7 additions & 0 deletions packages/react-core/src/components/Card/CardHeader.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { SFC, HTMLProps } from 'react';

export interface CardHeaderProps extends HTMLProps<HTMLDivElement> {}

declare const CardHeader: SFC<CardHeaderProps>;

export default CardHeader;
25 changes: 25 additions & 0 deletions packages/react-core/src/components/Card/CardHeader.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import PropTypes from 'prop-types';
import { css } from '@patternfly/react-styles';
import styles from '@patternfly/patternfly-next/components/Card/styles.css';

const propTypes = {
children: PropTypes.any,
className: PropTypes.string
};

const defaultProps = {
children: null,
className: ''
};

const CardHeader = ({ children, className, ...props }) => (
<div className={css(styles.cardHeader, className)} {...props}>
{children}
</div>
);

CardHeader.propTypes = propTypes;
CardHeader.defaultProps = defaultProps;

export default CardHeader;
4 changes: 4 additions & 0 deletions packages/react-core/src/components/Card/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default as Card, CardProps } from './Card';
export { default as CardBody, CardBodyProps } from './CardBody';
export { default as CardFooter, CardFooterProps } from './CardFooter';
export { default as CardHeader, CardHeaderProps } from './CardHeader';
4 changes: 4 additions & 0 deletions packages/react-core/src/components/Card/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
export { default as Card } from './Card';
export { default as CardBody } from './CardBody';
export { default as CardFooter } from './CardFooter';
export { default as CardHeader } from './CardHeader';
16 changes: 7 additions & 9 deletions packages/react-core/src/components/Title/Title.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
import { SFC, HTMLProps, ReactNode } from 'react';
import { Omit, OneOf } from '../../util';
import { Omit, OneOf } from '../../typeUtils';
import { BasesSizes } from '../../styles/sizes';

export const TitleSize: Pick<
typeof BasesSizes,
'md' | 'lg' | 'xl' | '2xl' | '3xl' | '4xl'
>;

export const TitleSize: {
xxxxl: 'xxxxl';
xxxl: 'xxxl';
xxl: 'xxl';
xl: 'xl';
lg: 'lg';
md: 'md';
};
export interface TitleProps
extends Omit<HTMLProps<HTMLHeadingElement>, 'size'> {
size: OneOf<typeof TitleSize, keyof typeof TitleSize>;
Expand Down
Loading

0 comments on commit b6f1b7a

Please sign in to comment.