Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,38 +1,25 @@
/* eslint-disable */

import styled, { css } from 'styled-components';
import styled from 'styled-components';
import getColor from './utils/getColor';
import getBackgroundColor from "./utils/getBackgroundColor";

const GrabWrapper = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
position: absolute;
top: 0px;
bottom: 0px;
left: 0;
padding-left: 10px;
border-right: 1px solid
${({ isOverEditBlock, isOverRemove, isSelected }) =>
getColor(isOverRemove, isSelected, isOverEditBlock)};
flex: 0 0 30px;
text-align: center;
background-color: ${({ isOver, isSelected, isSub }) => getBackgroundColor(isOver, isSelected, isSub)};
cursor: move;
z-index: 99;

${({ isOverRemove }) =>
isOverRemove &&
css`
g {
fill: #ffa784;
}
`}

${({ isSelected, isOverEditBlock }) =>
(isSelected || isOverEditBlock) &&
css`
g {
fill: #aed4fb;
}
`}

svg {
margin: 0;

g {
fill: ${({ isOver, isSelected }) => getColor(isOver, isSelected)};
}
}
`;

export default GrabWrapper;
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,16 @@ import styled from 'styled-components';

/* eslint-disable indent */
const NameWrapper = styled.div`
flex: 1;
position: relative;
line-height: 26px;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
cursor: pointer;

${({ isOverEditBlock, isOverRemove, isSelected }) => {
if (isOverRemove) {
return `
color: #f64d0a;
`;
}

if (isSelected || isOverEditBlock) {
return `
color: #007eff;
`;
}

return '';
}}
font-size: 13px;
font-weight: 500;
padding: 0 12px;
`;

export default NameWrapper;
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
import styled from 'styled-components';
import getColor from './utils/getColor';
import getBorderColor from "./utils/getBorderColor";
import getColor from "./utils/getColor";

/* eslint-disable indent */
const RemoveWrapper = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
position: absolute;
top: 0px;
bottom: 0px;
right: 0;
width: 30px;
flex: 0 0 30px;
text-align: center;
background-color: ${({ isOverEditBlock, isOverRemove, isSelected }) => {
return getColor(isOverRemove, isSelected, isOverEditBlock);
}};
background-color: ${({ isOver, isSelected }) => getBorderColor(isOver, isSelected)};
cursor: pointer;

svg {
align-self: center;
color: #b4b6ba;
}
${({ isOverRemove }) =>
isOverRemove &&
`

path {
fill: #f64d0a;
fill: ${({ isOver, isSelected }) => getColor(isOver, isSelected)};
}
`};
}
`;

export default RemoveWrapper;
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/* eslint-disable */

import styled from 'styled-components';
import getColor from './utils/getColor';
import getBorderColor from "./utils/getBorderColor";

const ResizeWrapper = styled.div`
display: flex;
flex-direction: column;
justify-content: center;
flex: 0 0 30px;
text-align: center;
background-color: ${({ isOver, isSelected }) => getBorderColor(isOver, isSelected)};
cursor: col-resize;

svg {
path {
fill: ${({ isOver, isSelected }) => getColor(isOver, isSelected)};
}
}
`;

export default ResizeWrapper;
Original file line number Diff line number Diff line change
@@ -1,36 +1,46 @@
/* eslint-disable */

import styled from 'styled-components';
import getColor from './utils/getColor';
import PropTypes from 'prop-types';
import getHeight from './utils/getHeight';
import getBackgroundColor from "./utils/getBackgroundColor";
import getBorderColor from "./utils/getBorderColor";

const SubWrapper = styled.div`
position: relative;
display: flex;
flex-direction: row;
min-height: ${({ withLongerHeight }) => getHeight(withLongerHeight)};
${({ withLongerHeight }) => {
if (!withLongerHeight) {
return `
height: 30px;
`;
}
}};

${({ withLongerHeight }) => (!withLongerHeight ? `height: 30px;` : ``)}
line-height: ${({ withLongerHeight }) => getHeight(withLongerHeight)};
cursor: pointer;

background: ${({ isOverEditBlock, isOverRemove, isSelected }) => {
if (isOverRemove) {
return '#ffe9e0';
} else if (isSelected || isOverEditBlock) {
return '#e6f0fb';
} else {
return '#fafafb';
}
}};
border: 1px solid
${({ isOverEditBlock, isOverRemove, isSelected }) =>
getColor(isOverRemove, isSelected, isOverEditBlock)};
background-color: ${({ isOver, isSelected, isSub }) => getBackgroundColor(isOver, isSelected, isSub)};
border: 1px solid ${({ isOver, isSelected }) => getBorderColor(isOver, isSelected)};
border-radius: 2px;

& > * {
border-right: 1px solid ${({ isOver, isSelected }) => getBorderColor(isOver, isSelected)};

&:last-child {
border: 0;
}
}

.grab,
.remove,
.resize {
svg {
align-self: center;
}
}
`;

SubWrapper.defaultProps = {
isOver: null,
};

SubWrapper.propTypes = {
isOver: PropTypes.string,
};

export default SubWrapper;
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import styled, { css } from 'styled-components';
import PropTypes from 'prop-types';
import getColor from './utils/getColor';
import getHeight from './utils/getHeight';

const Wrapper = styled.div`
Expand All @@ -17,118 +16,19 @@ const Wrapper = styled.div`
flex-shrink: 1;
min-width: 130px;
position: relative;

.sub_wrapper {
position: relative;
cursor: pointer;
background-color: ${({
isOverEditBlock,
isOverRemove,
isSelected,
isSub,
}) => {
if (isOverRemove) {
return '#ffe9e0';
} else if (isSelected || isOverEditBlock) {
return '#e6f0fb';
} else if (isSub) {
return '#ffffff';
} else {
return '#F2F3F4';
}
}};
border: 1px solid
${({ isOverEditBlock, isOverRemove, isSelected }) =>
getColor(isOverRemove, isSelected, isOverEditBlock)};
border-radius: 2px;
padding-left: 38px;
padding-right: 38px;

${({ isSub }) =>
isSub &&
css`
padding-left: 12px !important;
padding-right: 12px !important;

.grab,
.remove {
display: none;
}
`}

.name {
font-size: 13px;
font-weight: 500;

${({ isOverEditBlock, isSelected }) =>
(isSelected || isOverEditBlock) &&
css`
color: #007eff;
`}

${({ isOverRemove }) =>
isOverRemove &&
css`
color: #f64d0a;
`}
}
.grab {
border-right: 1px solid
${({ isOverEditBlock, isOverRemove, isSelected }) =>
getColor(isOverRemove, isSelected, isOverEditBlock)};

${({ isOverEditBlock, isSelected }) =>
(isSelected || isOverEditBlock) &&
css`
g {
fill: #aed4fb;
}
`}

${({ isOverRemove }) =>
isOverRemove &&
css`
g {
fill: #ffa784;
}
`}
}

.remove {
background-color: ${({ isOverEditBlock, isOverRemove, isSelected }) =>
getColor(isOverRemove, isSelected, isOverEditBlock)};
cursor: pointer;
svg {
align-self: center;

${({ isOverEditBlock, isSelected }) =>
(isSelected || isOverEditBlock) &&
css`
path {
fill: #007eff;
}
`}

${({ isOverRemove }) =>
isOverRemove &&
css`
path {
fill: #f64d0a;
}
`}
}
}
}
${({ isResizing }) => isResizing && `
border: 1px solid #ffcfcf;
background: #ffe1e1;
`}
border-radius: 2px;
`;

Wrapper.defaultProps = {
count: 1,
isSelected: false,
};

Wrapper.propTypes = {
count: PropTypes.number,
isSelected: PropTypes.bool,
};

export default Wrapper;
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = {
OVER_EDIT: 'edit',
OVER_REMOVE: 'remove',
OVER_GRAB: 'grab',
OVER_RESIZE: 'resize',
}
Loading