-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor spacer block to share edit method with the web. (#20746)
* Refactor spacer block to share edit method with the web. * Update code to now allow spacer larger than 500px. * Fix constant naming format.
- Loading branch information
1 parent
214c9fb
commit 7273202
Showing
5 changed files
with
72 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/** | ||
* External dependencies | ||
*/ | ||
import { View } from 'react-native'; | ||
/** | ||
* WordPress dependencies | ||
*/ | ||
import { withPreferredColorScheme } from '@wordpress/compose'; | ||
/** | ||
* Internal dependencies | ||
*/ | ||
import styles from './style.scss'; | ||
|
||
function ResizableBox( props ) { | ||
const { size, isSelected, getStylesFromColorScheme } = props; | ||
const { height } = size; | ||
const defaultStyle = getStylesFromColorScheme( | ||
styles.staticSpacer, | ||
styles.staticDarkSpacer | ||
); | ||
return ( | ||
<View | ||
style={ [ | ||
defaultStyle, | ||
isSelected && styles.selectedSpacer, | ||
{ height }, | ||
] } | ||
></View> | ||
); | ||
} | ||
|
||
export default withPreferredColorScheme( ResizableBox ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
.staticSpacer { | ||
height: 20px; | ||
background-color: transparent; | ||
border: $border-width dashed $light-gray-500; | ||
border-radius: 1px; | ||
} | ||
|
||
.staticDarkSpacer { | ||
border: $border-width dashed rgba($color: $light-gray-500, $alpha: 0.3); | ||
} | ||
|
||
.selectedSpacer { | ||
border: $border-width * 2 solid $blue-30; | ||
} |