File tree 2 files changed +27
-21
lines changed
packages/components/src/components/Collapsible 2 files changed +27
-21
lines changed Original file line number Diff line number Diff line change 1
1
import React from 'react' ;
2
2
import { Collapsible } from '.' ;
3
+ import { Text } from '../Text' ;
4
+ import { Element } from '../Element' ;
3
5
4
6
export default {
5
7
title : 'components/Collapsible' ,
6
8
component : Collapsible ,
7
9
} ;
8
10
9
- // replace the text inside with Text variants when available
10
11
export const Basic = ( ) => (
11
- < Collapsible title = "Files" >
12
- The move from Cerebral
13
- < br />
14
- This is a static template with no bundling
12
+ < Collapsible title = "Sandbox Info" >
13
+ < Element marginX = { 2 } >
14
+ < Text weight = "medium" marginBottom = { 2 } >
15
+ The move from Cerebral
16
+ </ Text >
17
+ < Text variant = "muted" > This is a static template with no bundling</ Text >
18
+ </ Element >
15
19
</ Collapsible >
16
20
) ;
17
21
18
22
export const DefaultOpen = ( ) => (
19
- < Collapsible title = "Files" defaultOpen >
20
- The move from Cerebral
21
- < br />
22
- This is a static template with no bundling
23
+ < Collapsible title = "Sandbox Info" defaultOpen >
24
+ < Element marginX = { 2 } >
25
+ < Text as = "div" weight = "medium" marginBottom = { 2 } >
26
+ The move from Cerebral
27
+ </ Text >
28
+ < Text variant = "muted" > This is a static template with no bundling</ Text >
29
+ </ Element >
23
30
</ Collapsible >
24
31
) ;
Original file line number Diff line number Diff line change @@ -2,12 +2,19 @@ import React from 'react';
2
2
import styled from 'styled-components' ;
3
3
import css from '@styled-system/css' ;
4
4
import { Element } from '../Element' ;
5
+ import { Text } from '../Text' ;
6
+
7
+ export const Section = styled ( Element ) . attrs ( { as : 'section' } ) (
8
+ css ( {
9
+ fontSize : 3 ,
10
+ } )
11
+ ) ;
5
12
6
13
export const Header = styled . div (
7
14
css ( {
8
15
display : 'flex' ,
9
16
alignItems : 'center' ,
10
- height : '32px' ,
17
+ height : 6 ,
11
18
paddingX : 3 ,
12
19
borderBottom : '1px solid' ,
13
20
// Note: sideBarSectionHeader exists but we dont use it because it is rarely implemented
@@ -24,14 +31,6 @@ export const Header = styled.div(
24
31
} )
25
32
) ;
26
33
27
- // temporary: replace with <Text variant="strong">
28
- export const Title = styled . div (
29
- css ( {
30
- fontSize : 3 ,
31
- fontWeight : 'semibold' ,
32
- } )
33
- ) ;
34
-
35
34
// temporary: replace with <Icon name="triangle/toggle">
36
35
export const Icon = styled . svg < {
37
36
open ?: boolean ;
@@ -82,12 +81,12 @@ export const Collapsible: React.FC<ICollapsibleProps> = ({
82
81
const toggle = ( ) => setOpen ( ! open ) ;
83
82
84
83
return (
85
- < Element as = "section" { ...props } >
84
+ < Section { ...props } >
86
85
< Header onClick = { toggle } >
87
86
< ToggleIcon open = { open } />
88
- < Title > { title } </ Title >
87
+ < Text weight = "medium" > { title } </ Text >
89
88
</ Header >
90
89
{ open ? < Body > { children } </ Body > : null }
91
- </ Element >
90
+ </ Section >
92
91
) ;
93
92
} ;
You can’t perform that action at this time.
0 commit comments