-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added color picker setting for public message and comp. Fixed a bug w…
…here protection did not work (#2)
- Loading branch information
Showing
15 changed files
with
3,142 additions
and
76 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
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
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
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
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,47 @@ | ||
import { __ } from '@wordpress/i18n'; | ||
import { Button, ColorIndicator, ColorPicker } from '@wordpress/components'; | ||
import { useState, useEffect } from '@wordpress/element'; | ||
|
||
const ColorPickerModal = (props) => { | ||
const [open, setOpen] = useState(false); | ||
const [color, setColor] = useState('#247cf9'); | ||
|
||
const saveColor = () => { | ||
setOpen(false); | ||
props.onChange(color); | ||
}; | ||
|
||
return ( | ||
<div className="color-picker-modal"> | ||
<div className="color-picker-modal__toggle"> | ||
<Button onClick={() => setOpen(!open)}> | ||
<ColorIndicator colorValue={props.color} /> | ||
{__('Change color', 'passnado')} | ||
</Button> | ||
</div> | ||
{open && ( | ||
<div className="color-picker-modal__modal"> | ||
<ColorPicker | ||
color={props.color} | ||
onChangeComplete={(color) => setColor(color.hex)} | ||
disableAlpha | ||
/> | ||
|
||
<div class="passnado-button-group"> | ||
<Button | ||
isPrimary={true} | ||
text={__('Save', 'passnado')} | ||
onClick={() => saveColor()} | ||
/> | ||
<Button | ||
isSecondary={true} | ||
text={__('Cancel', 'passnado')} | ||
onClick={() => setOpen(false)} | ||
/> | ||
</div> | ||
</div> | ||
)} | ||
</div> | ||
); | ||
}; | ||
export default ColorPickerModal; |
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
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
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,22 @@ | ||
.color-picker-modal { | ||
position: relative; | ||
&__toggle { | ||
.component-color-indicator { | ||
width: rem-calc(20); | ||
height: rem-calc(20); | ||
border-radius: 50%; | ||
margin-right: rem-calc(6); | ||
} | ||
} | ||
&__modal { | ||
z-index: 20; | ||
position: absolute; | ||
top: 100%; | ||
right: rem-calc(-18); | ||
max-width: rem-calc(400); | ||
padding: rem-calc(16); | ||
border-radius: rem-calc(4); | ||
background-color: $white; | ||
box-shadow: rgba(149, 157, 165, 0.2) 0px 8px 24px; | ||
} | ||
} |
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