Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: replace style will recover the origin style #139

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
7 changes: 1 addition & 6 deletions src/resizer.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,31 +37,27 @@ const styles = {
topRight: {
width: '20px',
height: '20px',
position: 'absolute',
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oops. it' s my mistake. thanks.

right: '-10px',
top: '-10px',
cursor: 'ne-resize',
},
bottomRight: {
width: '20px',
height: '20px',
position: 'absolute',
right: '-10px',
bottom: '-10px',
cursor: 'se-resize',
},
bottomLeft: {
width: '20px',
height: '20px',
position: 'absolute',
left: '-10px',
bottom: '-10px',
cursor: 'sw-resize',
},
topLeft: {
width: '20px',
height: '20px',
position: 'absolute',
left: '-10px',
top: '-10px',
cursor: 'nw-resize',
Expand All @@ -88,8 +84,7 @@ export default (props: Props): React.Element<'div'> => {
className={props.className}
style={{
...styles.base,
...styles[props.direction],
...(props.replaceStyles || {}),
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer the following :)

style={{
  ...styles.base,
  ...(props.className ? styles[props.direction] : {}),
  ...(props.replaceStyles || {})
}}

...(props.replaceStyles || styles[props.direction]),
}}
onMouseDown={(e: SyntheticMouseEvent<HTMLDivElement>) => {
props.onResizeStart(e, props.direction);
Expand Down