convert poll dragAndDrop component
This commit is contained in:
parent
c3bdbcc7b0
commit
2c40de2474
@ -3,8 +3,7 @@ import PropTypes from 'prop-types';
|
|||||||
import { withModalMounter } from '/imports/ui/components/modal/service';
|
import { withModalMounter } from '/imports/ui/components/modal/service';
|
||||||
|
|
||||||
import { defineMessages, injectIntl } from 'react-intl';
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
import { styles } from './styles.scss';
|
import Styled from './styles';
|
||||||
import Button from '/imports/ui/components/button/component';
|
|
||||||
|
|
||||||
|
|
||||||
// src: https://medium.com/@650egor/simple-drag-and-drop-file-upload-in-react-2cb409d88929
|
// src: https://medium.com/@650egor/simple-drag-and-drop-file-upload-in-react-2cb409d88929
|
||||||
@ -110,25 +109,20 @@ class DragAndDrop extends Component {
|
|||||||
const { intl, children } = this.props;
|
const { intl, children } = this.props;
|
||||||
const { pollValueText, drag } = this.state;
|
const { pollValueText, drag } = this.state;
|
||||||
return (
|
return (
|
||||||
<div
|
<Styled.DndContainer ref={this.dropRef}>
|
||||||
className={styles.dndContainer}
|
<Styled.DndTextArea
|
||||||
ref={this.dropRef}
|
active={drag}
|
||||||
>
|
|
||||||
<textarea
|
|
||||||
value={pollValueText}
|
value={pollValueText}
|
||||||
className={drag ? styles.dndActive : styles.dndInActive}
|
|
||||||
onChange={e => this.handleTextInput(e)}
|
onChange={e => this.handleTextInput(e)}
|
||||||
/>
|
/>
|
||||||
<Button
|
<Styled.DndButton
|
||||||
onClick={() => this.setPollValues()}
|
onClick={() => this.setPollValues()}
|
||||||
label={intl.formatMessage(intlMessages.customPollTextArea)}
|
label={intl.formatMessage(intlMessages.customPollTextArea)}
|
||||||
color="primary"
|
color="primary"
|
||||||
disabled={pollValueText < 1}
|
disabled={pollValueText < 1}
|
||||||
className={styles.btn}
|
|
||||||
/>
|
/>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</Styled.DndContainer>
|
||||||
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
} export default withModalMounter(injectIntl(DragAndDrop));
|
} export default withModalMounter(injectIntl(DragAndDrop));
|
||||||
|
@ -0,0 +1,32 @@
|
|||||||
|
import styled from 'styled-components';
|
||||||
|
import Button from '/imports/ui/components/button/component';
|
||||||
|
import { fontSizeSmall } from '/imports/ui/stylesheets/styled-components/typography';
|
||||||
|
|
||||||
|
const DndContainer = styled.div`
|
||||||
|
height: 200px;
|
||||||
|
`;
|
||||||
|
|
||||||
|
const DndTextArea = styled.textarea`
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
resize: none;
|
||||||
|
font-size: ${fontSizeSmall};
|
||||||
|
|
||||||
|
${({ active }) => active && `
|
||||||
|
background: grey;
|
||||||
|
`}
|
||||||
|
|
||||||
|
${({ active }) => !active && `
|
||||||
|
background: white;
|
||||||
|
`}
|
||||||
|
`;
|
||||||
|
|
||||||
|
const DndButton = styled(Button)`
|
||||||
|
width: 100%;
|
||||||
|
`;
|
||||||
|
|
||||||
|
export default {
|
||||||
|
DndContainer,
|
||||||
|
DndTextArea,
|
||||||
|
DndButton,
|
||||||
|
};
|
@ -1,26 +0,0 @@
|
|||||||
@import "/imports/ui/stylesheets/variables/_all";
|
|
||||||
|
|
||||||
.dndContainer {
|
|
||||||
height: 200px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.customPollValuesTextfield {
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
resize: none;
|
|
||||||
font-size: var(--font-size-small);
|
|
||||||
}
|
|
||||||
|
|
||||||
.dndActive {
|
|
||||||
@extend .customPollValuesTextfield;
|
|
||||||
background: grey;
|
|
||||||
}
|
|
||||||
|
|
||||||
.dndInActive {
|
|
||||||
@extend .customPollValuesTextfield;
|
|
||||||
background: white;
|
|
||||||
}
|
|
||||||
|
|
||||||
.btn {
|
|
||||||
width: 100%;
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user