Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Michael Iseard
Kudos-Donations
Commits
d66d8c74
Commit
d66d8c74
authored
Feb 03, 2021
by
Michael Iseard
Browse files
Allow more theme colours to be used
parent
a02034ea
Changes
5
Hide whitespace changes
Inline
Side-by-side
app/Front/Front.php
View file @
d66d8c74
...
...
@@ -83,10 +83,12 @@ class Front {
*/
public
function
get_kudos_root_styles
():
string
{
$primary
=
Settings
::
get_setting
(
'theme_color'
);
$theme_colours
=
Settings
::
get_setting
(
'theme_colors'
);
$primary
=
isset
(
$theme_colours
[
'primary'
])
?
$theme_colours
[
'primary'
]
:
'#ff9f1c'
;
$primary_dark
=
Utils
::
color_luminance
(
$primary
,
'-0.06'
);
$primary_darker
=
Utils
::
color_luminance
(
$primary
,
'-0.09'
);
$secondary
=
'#2ec4b6'
;
$secondary
=
isset
(
$theme_colours
[
'secondary'
])
?
$theme_colours
[
'secondary'
]
:
'#2ec4b6'
;
$secondary_dark
=
Utils
::
color_luminance
(
$secondary
,
'-0.06'
);
$secondary_darker
=
Utils
::
color_luminance
(
$secondary
,
'-0.09'
);
...
...
@@ -178,7 +180,7 @@ class Front {
$handle
,
'kudos'
,
[
'
theme_color
'
=>
Settings
::
get_setting
(
'
theme_color
'
),
'
color_primary
'
=>
Settings
::
get_setting
(
'
color_primary
'
),
]
);
wp_set_script_translations
(
$handle
,
'kudos-donations'
,
KUDOS_PLUGIN_DIR
.
'/languages'
);
...
...
app/Helpers/Settings.php
View file @
d66d8c74
...
...
@@ -97,10 +97,25 @@ class Settings {
'type'
=>
'string'
,
'show_in_rest'
=>
true
,
],
'theme_color'
=>
[
'type'
=>
'string'
,
'show_in_rest'
=>
true
,
'default'
=>
'#ff9f1c'
,
'theme_colors'
=>
[
'type'
=>
'object'
,
'show_in_rest'
=>
[
'schema'
=>
[
'type'
=>
'object'
,
'properties'
=>
[
'primary'
=>
[
'type'
=>
'string'
],
'secondary'
=>
[
'type'
=>
'string'
],
]
]
],
'default'
=>
[
'primary'
=>
'#ff9f1c'
,
'secondary'
=>
'#2ec4b6'
]
],
'address_enabled'
=>
[
'type'
=>
'boolean'
,
...
...
app/Service/ActivatorService.php
View file @
d66d8c74
...
...
@@ -79,6 +79,13 @@ class ActivatorService {
}
}
if
(
version_compare
(
$old_version
,
'2.3.2'
,
'<'
)
)
{
// Setting now replaced by 'theme_colors'
Settings
::
remove_setting
(
'theme_color'
);
}
}
self
::
create_donors_table
();
...
...
src/js/Settings/Components/Panels/ThemePanel.jsx
View file @
d66d8c74
...
...
@@ -12,16 +12,15 @@ const ThemePanel = (props) => {
return
(
<
SettingCard
title
=
{
"
Theme colour
"
}
id
=
"themeColor"
>
<
SettingCard
title
=
{
"
Theme colour
"
}
id
=
"themeColor"
{
...
props
}
>
<
BaseControl
label
=
{
__
(
'
Colour
'
,
'
kudos-donations
'
)
}
help
=
{
__
(
'
Set the colour for the Kudos button and the pop-up modal.
'
,
'
kudos-donations
'
)
}
>
<
ColorPalette
id
=
"_kudos_
theme_color
"
id
=
"_kudos_
color_primary
"
colors
=
{
colors
}
value
=
{
props
.
settings
.
_kudos_theme_color
}
onChange
=
{
(
value
)
=>
props
.
handleInputChange
(
'
_kudos_theme_color
'
,
value
)
}
value
=
{
props
.
settings
.
_kudos_theme_color
s
.
primary
}
onChange
=
{
(
value
)
=>
props
.
handleInputChange
(
'
_kudos_theme_color
s
'
,
{
primary
:
value
}
)
}
disableCustomColors
=
{
true
}
clearable
=
{
false
}
/>
...
...
src/js/kudos-button-block.jsx
View file @
d66d8c74
...
...
@@ -140,7 +140,7 @@ export default registerBlockType('iseardmedia/kudos-button', {
>
<
RichText
className
=
{
'
kd-transition kd-duration-150 kd-ease-in-out focus:kd-shadow-focus focus:kd-outline-none kd-font-sans kd-text-center kd-text-white kd-leading-normal kd-text-base kd-font-normal kd-normal-case kd-no-underline kd-w-auto kd-h-auto kd-inline-flex kd-items-center kd-select-none kd-py-3 kd-px-5 kd-m-1 kd-rounded-lg kd-cursor-pointer kd-shadow-none kd-border-none kd-bg-primary hover:kd-bg-primary-dark kudos_button_donate
'
}
style
=
{
{
backgroundColor
:
kudos
.
theme_color
}
}
style
=
{
{
backgroundColor
:
kudos
.
color_primary
}
}
formattingControls
=
{
[
'
bold
'
,
'
italic
'
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment