Commit 7aa6762 1 parent 1741c12 commit 7aa6762 Copy full SHA for 7aa6762
File tree 1 file changed +6
-4
lines changed
1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -23,19 +23,21 @@ const markup = name => {
23
23
if ( random ( 1 , 2 ) === 1 ) [ c1 , c2 ] = [ c2 , c1 ]
24
24
const alpha = genAlpha ( )
25
25
26
+ // create strings from function name
27
+ const id = name . replace ( / ( [ A - Z ] ) / g, '-$1' ) . toLowerCase ( )
28
+ const formatName = name . replace ( / ( [ A - Z ] ) / g, ' $1' )
29
+
26
30
// generate code example
27
31
const params = alpha === 1 ? `'${ c2 } '` : `'${ c2 } ', ${ alpha } `
28
32
const functionCode = `${ name } (${ params } )`
29
33
30
34
// generate actual markup
31
- const id = name . toLowerCase ( )
32
- const heroFunction = hero [ name ]
33
- const style = `background-position: center; background-color: ${ c1 } ; background-image: ${ heroFunction ( c2 , alpha ) } `
35
+ const style = `background-position: center; background-color: ${ c1 } ; background-image: ${ hero [ name ] ( c2 , alpha ) } `
34
36
const html = `
35
37
<div class="hero w-100 w-50-ns w-third-m w-25-l fl" id="${ id } " role="presentation">
36
38
<div class="hide-child aspect-ratio aspect-ratio--16x9" style="${ style } ">
37
39
<div class="child aspect-ratio--object bg-black-70 flex flex-column items-center justify-center pa3">
38
- <span class="white f5 f4-ns f3-l fw4 ttu tracked tc mt0 mb2">${ name } </span>
40
+ <span class="white f5 f4-ns f3-l fw4 ttu tracked tc mt0 mb2">${ formatName } </span>
39
41
<code class="mt2 pv2 ph3 ba b--white br2 code white f6 f5-ns">${ functionCode } </code>
40
42
</div>
41
43
</div>
You can’t perform that action at this time.
0 commit comments