Skip to content

Commit

Permalink
Merge pull request #33 from jangoergens/AddDescriptionSubtitleVariant
Browse files Browse the repository at this point in the history
Add DescriptionSubtitle variant
  • Loading branch information
Proskynete authored Feb 8, 2022
2 parents f655976 + 8cd9547 commit b31311a
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/components/description/index.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
import React from 'react';
import { string, oneOf } from 'prop-types';
import { Subtitle, DescriptionText } from '../../styles/main';
import {
Subtitle,
DescriptionText,
DescriptionSubtitle,
} from '../../styles/main';

const Description = (props) => {
const { variant, text } = props;

return variant === 'subtitle' ? (
<Subtitle>{text}</Subtitle>
) : (
<DescriptionText>{text}</DescriptionText>
);
switch (variant) {
case 'subtitle':
return <Subtitle>{text}</Subtitle>;
case 'descriptionSubtitle':
return <DescriptionSubtitle>{text}</DescriptionSubtitle>;
default:
return <DescriptionText>{text}</DescriptionText>;
}
};

Description.defaultProps = {
Expand All @@ -18,7 +25,7 @@ Description.defaultProps = {

Description.propTypes = {
text: string.isRequired,
variant: oneOf(['subtitle', 'description']),
variant: oneOf(['subtitle', 'description', 'descriptionSubtitle']),
};

export default Description;

0 comments on commit b31311a

Please sign in to comment.