@@ -15,25 +15,43 @@ import styles from './item.module.css'
15
15
const DomainContext = createContext ( {
16
16
domain : {
17
17
domainName : null ,
18
- subName : null
18
+ subName : null ,
19
+ branding : null // wip-brandings
19
20
}
20
21
} )
21
22
22
23
export const DomainProvider = ( { domain : ssrDomain , children } ) => {
23
24
const [ domain , setDomain ] = useState ( ssrDomain || null )
24
25
26
+ // wip-brandings: this is a sketch/hack to set the branding colors
27
+ const setBrandingColors = ( branding ) => {
28
+ document . documentElement . style . setProperty ( '--bs-transition' , 'all 0.3s ease' )
29
+ if ( branding . primaryColor ) {
30
+ document . documentElement . style . setProperty ( '--theme-primary' , branding . primaryColor )
31
+ }
32
+ if ( branding . secondaryColor ) {
33
+ document . documentElement . style . setProperty ( '--theme-secondary' , branding . secondaryColor )
34
+ }
35
+
36
+ return ( ) => {
37
+ document . documentElement . style . removeProperty ( '--bs-transition' )
38
+ }
39
+ }
40
+
25
41
// maintain the custom domain state across re-renders
26
42
useEffect ( ( ) => {
27
43
if ( ssrDomain && ! domain ) {
28
44
setDomain ( ssrDomain )
29
45
}
30
- } , [ ssrDomain ] )
31
46
32
- // TODO: Placeholder for Auth Sync
47
+ // wip-brandings: set the branding colors
48
+ if ( ssrDomain ?. branding ) {
49
+ setBrandingColors ( ssrDomain . branding )
50
+ }
51
+ } , [ ssrDomain ] )
33
52
34
53
return (
35
54
< DomainContext . Provider value = { { domain } } >
36
- { /* TODO: Placeholder for Branding */ }
37
55
{ children }
38
56
</ DomainContext . Provider >
39
57
)
0 commit comments