@@ -8,6 +8,7 @@ import FormContainer from "global/containers/form";
88import { settingsAPI , requests } from "api" ;
99import { select } from "utils/entityUtils" ;
1010import PageHeader from "backend/components/layout/PageHeader" ;
11+ import HeaderPreview from "backend/components/theme/HeaderPreview" ;
1112
1213export class SettingsThemeContainer extends PureComponent {
1314 static mapStateToProps = state => {
@@ -25,6 +26,7 @@ export class SettingsThemeContainer extends PureComponent {
2526 render ( ) {
2627 if ( ! this . props . settings ) return null ;
2728 const t = this . props . t ;
29+
2830 return (
2931 < div >
3032 < PageHeader title = { t ( "settings.theme.header" ) } type = "settings" />
@@ -36,95 +38,118 @@ export class SettingsThemeContainer extends PureComponent {
3638 create = { settingsAPI . update }
3739 className = "form-secondary"
3840 >
39- < Form . FieldGroup label = { t ( "settings.theme.branding_header" ) } >
40- < Form . TextInput
41- label = { t ( "settings.theme.url_label" ) }
42- name = "attributes[general][pressSite]"
43- placeholder = { t ( "settings.theme.url_placeholder" ) }
44- wide
45- instructions = { t ( "settings.theme.url_instructions" ) }
46- />
47- < Form . Upload
48- accepts = "images"
49- label = { t ( "settings.theme.header_logo_label" ) }
50- readFrom = "attributes[pressLogoStyles][small]"
51- name = "attributes[pressLogo]"
52- remove = "attributes[removePressLogo]"
53- instructions = { t ( "settings.theme.header_logo_instructions" ) }
54- />
55- < Form . Upload
56- accepts = "images"
57- label = { t ( "settings.theme.mobile_logo_label" ) }
58- readFrom = "attributes[pressLogoMobileStyles][small]"
59- name = "attributes[pressLogoMobile]"
60- remove = "attributes[removePressLogoMobile]"
61- instructions = { t ( "settings.theme.mobile_logo_instructions" ) }
62- />
63- < Form . Upload
64- accepts = "images"
65- label = { t ( "settings.theme.footer_logo_label" ) }
66- readFrom = "attributes[pressLogoFooterStyles][small]"
67- name = "attributes[pressLogoFooter]"
68- remove = "attributes[removePressLogoFooter]"
69- instructions = { t ( "settings.theme.footer_logo_instructions" ) }
70- />
71- < Form . Upload
72- accepts = "images"
73- label = { t ( "settings.theme.favicon_label" ) }
74- readFrom = "attributes[faviconStyles][original]"
75- name = "attributes[favicon]"
76- remove = "attributes[removeFavicon]"
77- instructions = { t ( "settings.theme.favicon_instructions" ) }
78- />
79- < Form . TextInput
80- label = { t ( "settings.theme.logo_styles_label" ) }
81- name = "attributes[theme][logoStyles]"
82- placeholder = { t ( "settings.theme.logo_styles_placeholder" ) }
83- instructions = { t ( "settings.theme.logo_styles_instructions" ) }
84- />
85- < Form . TextInput
86- label = { t ( "settings.theme.offset_label" ) }
87- name = "attributes[theme][headerOffset]"
88- placeholder = "0"
89- instructions = { t ( "settings.theme.offset_instructions" ) }
90- />
91- </ Form . FieldGroup >
92- < Form . FieldGroup label = { t ( "settings.theme.colors_header" ) } >
93- < Form . ColorInput
94- label = { t ( "settings.theme.accent_color_label" ) }
95- name = "attributes[theme][accentColor]"
96- defaultValue = "#52e3ac"
97- instructions = { t ( "settings.theme.accent_color_instructions" ) }
98- />
99- < Form . ColorInput
100- label = { t ( "settings.theme.foreground_color_label" ) }
101- name = "attributes[theme][headerForegroundColor]"
102- defaultValue = "#ffffff"
103- instructions = { t ( "settings.theme.foreground_color_instructions" ) }
104- />
105- < Form . ColorInput
106- label = { t ( "settings.theme.active_foreground_color_label" ) }
107- name = "attributes[theme][headerForegroundActiveColor]"
108- defaultValue = "#363636"
109- instructions = { t (
110- "settings.theme.active_foreground_color_instructions"
111- ) }
112- />
113- < Form . ColorInput
114- label = { t ( "settings.theme.background_color_label" ) }
115- name = "attributes[theme][headerBackgroundColor]"
116- defaultValue = "#696969"
117- instructions = { t ( "settings.theme.background_color_instructions" ) }
118- />
119- </ Form . FieldGroup >
120- < Form . FieldGroup label = { t ( "settings.theme.typography_header" ) } >
121- < Form . TextInput
122- label = { t ( "settings.theme.typekit_label" ) }
123- name = "attributes[theme][typekitId]"
124- placeholder = { t ( "settings.theme.typekit_placeholder" ) }
125- />
126- </ Form . FieldGroup >
127- < Form . Save text = { t ( "settings.save" ) } />
41+ { getValue => (
42+ < >
43+ < Form . FieldGroup label = { t ( "settings.theme.branding_header" ) } >
44+ < Form . TextInput
45+ label = { t ( "settings.theme.url_label" ) }
46+ name = "attributes[general][pressSite]"
47+ placeholder = { t ( "settings.theme.url_placeholder" ) }
48+ wide
49+ instructions = { t ( "settings.theme.url_instructions" ) }
50+ />
51+ < Form . Upload
52+ accepts = "images"
53+ label = { t ( "settings.theme.header_logo_label" ) }
54+ readFrom = "attributes[pressLogoStyles][small]"
55+ name = "attributes[pressLogo]"
56+ remove = "attributes[removePressLogo]"
57+ instructions = { t ( "settings.theme.header_logo_instructions" ) }
58+ />
59+ < Form . Upload
60+ accepts = "images"
61+ label = { t ( "settings.theme.mobile_logo_label" ) }
62+ readFrom = "attributes[pressLogoMobileStyles][small]"
63+ name = "attributes[pressLogoMobile]"
64+ remove = "attributes[removePressLogoMobile]"
65+ instructions = { t ( "settings.theme.mobile_logo_instructions" ) }
66+ />
67+ < Form . Upload
68+ accepts = "images"
69+ label = { t ( "settings.theme.footer_logo_label" ) }
70+ readFrom = "attributes[pressLogoFooterStyles][small]"
71+ name = "attributes[pressLogoFooter]"
72+ remove = "attributes[removePressLogoFooter]"
73+ instructions = { t ( "settings.theme.footer_logo_instructions" ) }
74+ />
75+ < Form . Upload
76+ accepts = "images"
77+ label = { t ( "settings.theme.favicon_label" ) }
78+ readFrom = "attributes[faviconStyles][original]"
79+ name = "attributes[favicon]"
80+ remove = "attributes[removeFavicon]"
81+ instructions = { t ( "settings.theme.favicon_instructions" ) }
82+ />
83+ < Form . TextInput
84+ label = { t ( "settings.theme.logo_styles_label" ) }
85+ name = "attributes[theme][logoStyles]"
86+ placeholder = { t ( "settings.theme.logo_styles_placeholder" ) }
87+ instructions = { t ( "settings.theme.logo_styles_instructions" ) }
88+ />
89+ < Form . TextInput
90+ label = { t ( "settings.theme.offset_label" ) }
91+ name = "attributes[theme][headerOffset]"
92+ placeholder = "0"
93+ instructions = { t ( "settings.theme.offset_instructions" ) }
94+ />
95+ </ Form . FieldGroup >
96+ < Form . FieldGroup label = { t ( "settings.theme.colors_header" ) } >
97+ < Form . ColorInput
98+ label = { t ( "settings.theme.accent_color_label" ) }
99+ name = "attributes[theme][accentColor]"
100+ defaultValue = "#52e3ac"
101+ instructions = { t ( "settings.theme.accent_color_instructions" ) }
102+ />
103+ < Form . ColorInput
104+ label = { t ( "settings.theme.foreground_color_label" ) }
105+ name = "attributes[theme][headerForegroundColor]"
106+ defaultValue = "#ffffff"
107+ instructions = { t (
108+ "settings.theme.foreground_color_instructions"
109+ ) }
110+ />
111+ < Form . ColorInput
112+ label = { t ( "settings.theme.active_foreground_color_label" ) }
113+ name = "attributes[theme][headerForegroundActiveColor]"
114+ defaultValue = "#363636"
115+ instructions = { t (
116+ "settings.theme.active_foreground_color_instructions"
117+ ) }
118+ />
119+ < Form . ColorInput
120+ label = { t ( "settings.theme.background_color_label" ) }
121+ name = "attributes[theme][headerBackgroundColor]"
122+ defaultValue = "#696969"
123+ instructions = { t (
124+ "settings.theme.background_color_instructions"
125+ ) }
126+ />
127+ < Form . FieldWrapper >
128+ < Form . Label label = "Header Preview" />
129+ < HeaderPreview
130+ accentColor = { getValue ( "attributes[theme][accentColor]" ) }
131+ foregroundColor = { getValue (
132+ "attributes[theme][headerForegroundColor]"
133+ ) }
134+ backgroundColor = { getValue (
135+ "attributes[theme][headerBackgroundColor]"
136+ ) }
137+ activeColor = { getValue (
138+ "attributes[theme][headerForegroundActiveColor]"
139+ ) }
140+ />
141+ </ Form . FieldWrapper >
142+ </ Form . FieldGroup >
143+ < Form . FieldGroup label = { t ( "settings.theme.typography_header" ) } >
144+ < Form . TextInput
145+ label = { t ( "settings.theme.typekit_label" ) }
146+ name = "attributes[theme][typekitId]"
147+ placeholder = { t ( "settings.theme.typekit_placeholder" ) }
148+ />
149+ </ Form . FieldGroup >
150+ < Form . Save text = { t ( "settings.save" ) } />
151+ </ >
152+ ) }
128153 </ FormContainer . Form >
129154 </ Layout . BackendPanel >
130155 </ div >
0 commit comments