Skip to content

Commit

Permalink
feat: InfoBox className (#638)
Browse files Browse the repository at this point in the history
InfoBox/NewBox now accept a className prop, in which you can add additional css information. NewBox makes use of this by default.

ERM-3040
  • Loading branch information
EthanFreestone authored Sep 20, 2023
1 parent e23005f commit c83e5c5
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
5 changes: 3 additions & 2 deletions lib/InfoBox/InfoBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import PropTypes from 'prop-types';
import classNames from 'classnames';
import css from './InfoBox.css';

const InfoBox = ({ children, type }) => {
const InfoBox = ({ children, className, type }) => {
const classnames = [css.infoBox];

switch (type) {
Expand All @@ -24,7 +24,7 @@ const InfoBox = ({ children, type }) => {
return (
<span
className={
classNames(classnames)
classNames(classnames, className)
}
>
{children}
Expand All @@ -38,6 +38,7 @@ InfoBox.propTypes = {
PropTypes.node,
PropTypes.func,
]).isRequired,
className: PropTypes.string,
type: PropTypes.oneOf([
'success',
'warn',
Expand Down
3 changes: 3 additions & 0 deletions lib/NewBox/NewBox.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.newBox {
text-wrap: nowrap;
}
15 changes: 14 additions & 1 deletion lib/NewBox/NewBox.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,25 @@
import PropTypes from 'prop-types';

import { FormattedMessage } from 'react-intl';
import classNames from 'classnames';

import InfoBox from '../InfoBox';

const NewBox = () => (
import css from './NewBox.css';

const NewBox = ({ className }) => (
<InfoBox
className={
classNames(css.newBox, className)
}
type="success"
>
<FormattedMessage id="stripes-erm-components.new" />
</InfoBox>
);

NewBox.propTypes = {
className: PropTypes.string,
};

export default NewBox;

0 comments on commit c83e5c5

Please sign in to comment.