Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Commit

Permalink
fix(file-input): correct line height and add className prop
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikThePendric authored and varl committed Nov 25, 2019
1 parent 2f4a1cf commit c6b79d5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
5 changes: 4 additions & 1 deletion src/FileInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ class FileInput extends PureComponent {

render() {
const {
className,
label,
buttonLabel,
error,
Expand All @@ -40,7 +41,7 @@ class FileInput extends PureComponent {
} = this.props

return (
<div>
<div className={cx('container', className)}>
{label && <p className={cx('label', { required })}>{label}</p>}

<input
Expand Down Expand Up @@ -92,6 +93,7 @@ class FileInput extends PureComponent {
.button-container {
display: flex;
align-items: center;
padding-bottom: ${spacers.dp4};
}
.button-container > :global(svg) {
Expand All @@ -115,6 +117,7 @@ const childPropType = propTypes.oneOfType([
])

FileInput.propTypes = {
className: propTypes.string,
onChange: propTypes.func.isRequired,

label: propTypes.string,
Expand Down
9 changes: 6 additions & 3 deletions src/FileInput/SelectedFile.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,21 @@
import React from 'react'
import propTypes from 'prop-types'
import cx from 'classnames'

import { colors, spacers } from '../theme.js'
import { AttachFile } from '../icons/AttachFile.js'
import { Loading } from '../icons/Status.js'

const SelectedFile = ({
className,
label,
onRemove,
removeText,
loading,
onCancel,
cancelText,
}) => (
<p>
<p className={cx('selected-file', className)}>
<span className="icon">{loading ? <Loading /> : <AttachFile />}</span>

<span className="text">
Expand All @@ -36,8 +38,8 @@ const SelectedFile = ({
p {
display: flex;
margin: 0;
padding-top: ${spacers.dp8};
line-height: 14px;
padding-top: ${spacers.dp4};
line-height: 18px;
}
.icon > :global(svg) {
width: 12px;
Expand Down Expand Up @@ -74,6 +76,7 @@ const SelectedFile = ({
)

SelectedFile.propTypes = {
className: propTypes.string,
label: propTypes.string.isRequired,
onRemove: propTypes.func.isRequired,
removeText: propTypes.string.isRequired,
Expand Down

0 comments on commit c6b79d5

Please sign in to comment.