1
1
import * as React from 'react'
2
2
import * as _ from 'lodash'
3
- import { Menu , ProviderConsumer , Grid , Text } from '@stardust-ui/react'
3
+ import { Menu , Grid , Text } from '@stardust-ui/react'
4
4
5
5
const items = [
6
6
{ key : 'editorials' , content : 'Editorials' } ,
@@ -14,48 +14,45 @@ const iconItems = [
14
14
{ key : 'search' , icon : 'search' } ,
15
15
]
16
16
17
- const MenuExampleColor = ( ) => (
18
- < ProviderConsumer
19
- render = { ( { siteVariables : { colorScheme } } ) => {
20
- const colorsArr = _ . keys ( colorScheme )
21
- const colors = _ . times ( 7 , num => colorsArr [ num % colorsArr . length ] )
22
-
23
- return (
24
- < Grid
25
- columns = "repeat(2, auto)"
26
- styles = { { justifyContent : 'left' , justifyItems : 'left' , alignItems : 'center' } }
27
- variables = { { gridGap : '10px' } }
28
- >
29
- < Text content = { `${ _ . upperCase ( colors [ 0 ] ) } DEFAULT MENU:` } weight = "bold" />
30
- < Menu defaultActiveIndex = { 0 } color = { colors [ 0 ] } items = { items } />
31
- < Text content = { `${ _ . upperCase ( colors [ 1 ] ) } PILLS MENU:` } weight = "bold" />
32
- < Menu defaultActiveIndex = { 0 } color = { colors [ 1 ] } pills items = { items } />
33
- < Text content = { `${ _ . upperCase ( colors [ 2 ] ) } POINTING MENU:` } weight = "bold" />
34
- < Menu defaultActiveIndex = { 0 } color = { colors [ 2 ] } pointing items = { items } />
35
- < Text content = { `${ _ . upperCase ( colors [ 3 ] ) } VERTICAL POINTING MENU:` } weight = "bold" />
36
- < Menu defaultActiveIndex = { 0 } color = { colors [ 3 ] } vertical pointing items = { items } />
37
- < Text content = { `${ _ . upperCase ( colors [ 4 ] ) } UNDERLINED MENU:` } weight = "bold" />
38
- < Menu defaultActiveIndex = { 0 } color = { colors [ 4 ] } underlined items = { items } />
39
- < Text content = { `${ _ . upperCase ( colors [ 5 ] ) } ICON MENU:` } weight = "bold" />
40
- < Menu defaultActiveIndex = { 0 } color = { colors [ 5 ] } items = { iconItems } />
41
- < Text content = { `${ _ . upperCase ( colors [ 6 ] ) } ICON ONLY MENU:` } weight = "bold" />
42
- < Menu
43
- defaultActiveIndex = { 0 }
44
- color = { colors [ 6 ] }
45
- iconOnly
46
- items = { iconItems . map ( item => _ . pick ( item , [ 'key' , 'icon' ] ) ) }
47
- />
48
- < Text content = { `UNDERLINED MENU (mutiple colors):` } weight = "bold" />
49
- < Menu
50
- defaultActiveIndex = { 0 }
51
- underlined
52
- color = { { foreground : colors [ 4 ] , background : colors [ 5 ] , border : colors [ 1 ] } }
53
- items = { items }
54
- />
55
- </ Grid >
56
- )
57
- } }
58
- />
17
+ const MenuExampleColor = ( {
18
+ knobs : {
19
+ selectedItem : { name, value } ,
20
+ } ,
21
+ } : {
22
+ knobs : { selectedItem : { name : string ; value : string } }
23
+ } ) => (
24
+ < Grid
25
+ columns = "repeat(2, auto)"
26
+ styles = { { justifyContent : 'left' , justifyItems : 'left' , alignItems : 'center' } }
27
+ variables = { { gridGap : '10px' } }
28
+ >
29
+ < Text content = { `${ name } DEFAULT MENU:` } weight = "bold" />
30
+ < Menu defaultActiveIndex = { 0 } color = { value } items = { items } />
31
+ < Text content = { `${ name } PILLS MENU:` } weight = "bold" />
32
+ < Menu defaultActiveIndex = { 0 } color = { value } pills items = { items } />
33
+ < Text content = { `${ name } POINTING MENU:` } weight = "bold" />
34
+ < Menu defaultActiveIndex = { 0 } color = { value } pointing items = { items } />
35
+ < Text content = { `${ name } VERTICAL POINTING MENU:` } weight = "bold" />
36
+ < Menu defaultActiveIndex = { 0 } color = { value } vertical pointing items = { items } />
37
+ < Text content = { `${ name } UNDERLINED MENU:` } weight = "bold" />
38
+ < Menu defaultActiveIndex = { 0 } color = { value } underlined items = { items } />
39
+ < Text content = { `${ name } ICON MENU:` } weight = "bold" />
40
+ < Menu defaultActiveIndex = { 0 } color = { value } items = { iconItems } />
41
+ < Text content = { `${ name } ICON ONLY MENU:` } weight = "bold" />
42
+ < Menu
43
+ defaultActiveIndex = { 0 }
44
+ color = { value }
45
+ iconOnly
46
+ items = { iconItems . map ( item => _ . pick ( item , [ 'key' , 'icon' ] ) ) }
47
+ />
48
+ < Text content = { `UNDERLINED MENU (mutiple colors):` } weight = "bold" />
49
+ { /* <Menu
50
+ defaultActiveIndex={0}
51
+ underlined
52
+ color={{ foreground: value, background: value, border: value }}
53
+ items={items}
54
+ /> */ }
55
+ </ Grid >
59
56
)
60
57
61
58
export default MenuExampleColor
0 commit comments