mirror of
https://github.com/seigler/triplebyte-react-spa
synced 2025-07-26 07:16:10 +00:00
38 lines
824 B
JavaScript
38 lines
824 B
JavaScript
import React from 'react';
|
|
import { useDispatch } from 'react-redux'
|
|
|
|
import { withRedux } from 'lib/redux';
|
|
|
|
const addCard = ({ column }) => {
|
|
const dispatch = useDispatch();
|
|
return <>
|
|
<a className='addCard' onClick={
|
|
() => {
|
|
const userText = window.prompt('New card text:', '');
|
|
if (userText !== null) {
|
|
dispatch({ type: 'ADD_CARD', payload: {
|
|
column,
|
|
text: userText
|
|
}});
|
|
}
|
|
}
|
|
}><span>+</span> Add a card</a>
|
|
<style jsx>{`
|
|
.addCard {
|
|
margin-top: 12px;
|
|
cursor: pointer;
|
|
opacity: 0.4;
|
|
display: block;
|
|
padding: 0 8px;
|
|
}
|
|
.addCard:hover {
|
|
opacity: 1;
|
|
}
|
|
span {
|
|
font-size: 1.5em;
|
|
}
|
|
`}</style>
|
|
</>;
|
|
}
|
|
|
|
export default withRedux(addCard);
|