Skip to content

Commit

Permalink
fix(Filename): Props filename was required
Browse files Browse the repository at this point in the history
  • Loading branch information
JF-Cozy committed Mar 29, 2023
1 parent 1ddd12c commit 910ff05
Showing 1 changed file with 23 additions and 15 deletions.
38 changes: 23 additions & 15 deletions react/Filename/index.jsx
Expand Up @@ -15,20 +15,28 @@ const Filename = ({ icon, filename, extension, variant }) => {
<Icon className={'u-mr-1'} icon={icon} width={30} height={30} />
</Img>
)}
<Bd className={styles['c-filename-wrapper']}>
<Typography
variant={variant}
component="span"
className={cx(styles['c-filename-name'], 'u-ellipsis')}
>
{filename}
</Typography>
{extension && (
<Typography variant={variant} component="span" color="textSecondary">
{extension}
</Typography>
)}
</Bd>
{(filename || extension) && (
<Bd className={styles['c-filename-wrapper']}>
{filename && (
<Typography
variant={variant}
component="span"
className={cx(styles['c-filename-name'], 'u-ellipsis')}
>
{filename}
</Typography>
)}
{extension && (
<Typography
variant={variant}
component="span"
color="textSecondary"
>
{extension}
</Typography>
)}
</Bd>
)}
</Media>
)
}
Expand All @@ -41,7 +49,7 @@ Filename.propTypes = {
PropTypes.func
]),
/** folder or file name */
filename: PropTypes.string.isRequired,
filename: PropTypes.string,
/** If a file name, you can specify the extension */
extension: PropTypes.string,
variant: PropTypes.string
Expand Down

0 comments on commit 910ff05

Please sign in to comment.