Lidarr/frontend/src/InteractiveImport/Folder/RecentFolderRow.js

66 lines
1.5 KiB
JavaScript
Raw Normal View History

2017-09-04 02:20:56 +00:00
import PropTypes from 'prop-types';
import React, { Component } from 'react';
import IconButton from 'Components/Link/IconButton';
2017-09-04 02:20:56 +00:00
import RelativeDateCellConnector from 'Components/Table/Cells/RelativeDateCellConnector';
2020-09-07 01:33:10 +00:00
import TableRowCell from 'Components/Table/Cells/TableRowCell';
import TableRowButton from 'Components/Table/TableRowButton';
import { icons } from 'Helpers/Props';
2021-10-03 15:01:09 +00:00
import translate from 'Utilities/String/translate';
import styles from './RecentFolderRow.css';
2017-09-04 02:20:56 +00:00
class RecentFolderRow extends Component {
//
// Listeners
onPress = () => {
this.props.onPress(this.props.folder);
}
onRemovePress = (event) => {
event.stopPropagation();
const {
folder,
onRemoveRecentFolderPress
} = this.props;
onRemoveRecentFolderPress(folder);
}
2017-09-04 02:20:56 +00:00
//
// Render
render() {
const {
folder,
lastUsed
} = this.props;
return (
<TableRowButton onPress={this.onPress}>
<TableRowCell>{folder}</TableRowCell>
<RelativeDateCellConnector date={lastUsed} />
<TableRowCell className={styles.actions}>
<IconButton
2021-10-03 15:01:09 +00:00
title={translate('Remove')}
name={icons.REMOVE}
onPress={this.onRemovePress}
/>
</TableRowCell>
2017-09-04 02:20:56 +00:00
</TableRowButton>
);
}
}
RecentFolderRow.propTypes = {
folder: PropTypes.string.isRequired,
lastUsed: PropTypes.string.isRequired,
onPress: PropTypes.func.isRequired,
onRemoveRecentFolderPress: PropTypes.func.isRequired
2017-09-04 02:20:56 +00:00
};
export default RecentFolderRow;