mirror of
https://github.com/Unleash/unleash.git
synced 2025-05-03 01:18:43 +02:00
fix: convert variant-view-component to function
This commit is contained in:
parent
d4e2296fda
commit
61cd47a0e7
@ -1,28 +1,25 @@
|
||||
import React, { Component } from 'react';
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import { IconButton } from 'react-mdl';
|
||||
import styles from './variant.scss';
|
||||
import { UPDATE_FEATURE } from '../../../permissions';
|
||||
|
||||
class VariantViewComponent extends Component {
|
||||
render() {
|
||||
const { variant, editVariant, removeVariant, hasPermission } = this.props;
|
||||
return (
|
||||
<tr>
|
||||
<td onClick={editVariant}>{variant.name}</td>
|
||||
<td>{variant.weight}</td>
|
||||
{hasPermission(UPDATE_FEATURE) ? (
|
||||
<td className={styles.actions}>
|
||||
<IconButton name="expand_more" onClick={editVariant} />
|
||||
<IconButton name="delete" onClick={removeVariant} />
|
||||
</td>
|
||||
) : (
|
||||
<td className={styles.actions} />
|
||||
)}
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
function VariantViewComponent({ variant, editVariant, removeVariant, hasPermission }) {
|
||||
return (
|
||||
<tr>
|
||||
<td onClick={editVariant}>{variant.name}</td>
|
||||
<td>{variant.weight}</td>
|
||||
{hasPermission(UPDATE_FEATURE) ? (
|
||||
<td className={styles.actions}>
|
||||
<IconButton name="expand_more" onClick={editVariant} />
|
||||
<IconButton name="delete" onClick={removeVariant} />
|
||||
</td>
|
||||
) : (
|
||||
<td className={styles.actions} />
|
||||
)}
|
||||
</tr>
|
||||
);
|
||||
}
|
||||
|
||||
VariantViewComponent.propTypes = {
|
||||
|
Loading…
Reference in New Issue
Block a user