1
1
/** @jsx jsx */
2
- import { jsx , get } from 'theme-ui'
2
+ import { jsx , get , useThemeUI } from 'theme-ui'
3
3
import { useState , useEffect , Fragment } from 'react'
4
4
import merge from 'deepmerge'
5
5
import Logo from './logo'
@@ -54,6 +54,10 @@ const initialState = {
54
54
55
55
const Node = ( { x, y, color = 0 , ...props } ) => {
56
56
const inset = ! ! ( y % 2 )
57
+
58
+ // adjust for logo position
59
+ const isLogo = y === 2 && x === 0
60
+
57
61
return (
58
62
< circle
59
63
{ ...props }
@@ -63,7 +67,7 @@ const Node = ({ x, y, color = 0, ...props }) => {
63
67
fill = "currentcolor"
64
68
strokeWidth = { 1 / 8 }
65
69
sx = { {
66
- color : colors [ color ] || 'background' ,
70
+ color : isLogo ? 'background' : colors [ color ] || 'background' ,
67
71
transitionProperty : 'stroke, color' ,
68
72
transitionTimingFunction : 'ease-out' ,
69
73
transitionDuration : '.4s' ,
@@ -137,6 +141,7 @@ const randomizeColors = state => {
137
141
}
138
142
139
143
export default ( { width = 32 , height = 9 , scale = 32 } ) => {
144
+ const { theme } = useThemeUI ( )
140
145
const rows = Array . from ( { length : height / 3 } ) . map ( ( n , y ) =>
141
146
Array . from ( {
142
147
length : Math . floor ( width / 3 + ( y % 2 ? 0 : 1 ) ) ,
@@ -171,6 +176,8 @@ export default ({ width = 32, height = 9, scale = 32 }) => {
171
176
)
172
177
}
173
178
179
+ const logoColor = get ( theme . colors , `${ get ( colors , get ( state , '2.0' ) || 1 ) } ` )
180
+
174
181
return (
175
182
< svg
176
183
xmlns = "http://www.w3.org/2000/svg"
@@ -199,7 +206,7 @@ export default ({ width = 32, height = 9, scale = 32 }) => {
199
206
) )
200
207
) }
201
208
< g transform = "translate(0 6)" >
202
- < Logo size = { 2 } />
209
+ < Logo size = { 2 } color = { logoColor } />
203
210
</ g >
204
211
</ svg >
205
212
)
0 commit comments