Browse Source

Destructured props

pull/2032/head
t1enne 3 years ago
parent
commit
d1ea0fa81b
  1. 5
      web/components/action-buttons/ActionButton.tsx

5
web/components/action-buttons/ActionButton.tsx

@ -8,10 +8,8 @@ interface Props {
action: ExternalAction; action: ExternalAction;
} }
export default function ActionButton(props: Props) { export default function ActionButton({action: { url, title, description, icon, openExternally }}: Props) {
const [showModal, setShowModal] = useState(false); const [showModal, setShowModal] = useState(false);
const { action } = props;
const { url, title, description, icon, color, openExternally } = action;
const buttonClicked = () => { const buttonClicked = () => {
if (openExternally) { if (openExternally) {
@ -27,7 +25,6 @@ export default function ActionButton(props: Props) {
type="primary" type="primary"
className={`${s.button}`} className={`${s.button}`}
onClick={buttonClicked} onClick={buttonClicked}
style={{ backgroundColor: color }}
> >
<img src={icon} className={`${s.icon}`} alt={description} /> <img src={icon} className={`${s.icon}`} alt={description} />
{title} {title}

Loading…
Cancel
Save