File tree Expand file tree Collapse file tree 2 files changed +27
-21
lines changed
packages/components/src/components/Collapsible Expand file tree Collapse file tree 2 files changed +27
-21
lines changed Original file line number Diff line number Diff line change 11import React from 'react' ;
22import { Collapsible } from '.' ;
3+ import { Text } from '../Text' ;
4+ import { Element } from '../Element' ;
35
46export default {
57 title : 'components/Collapsible' ,
68 component : Collapsible ,
79} ;
810
9- // replace the text inside with Text variants when available
1011export 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 >
1519 </ Collapsible >
1620) ;
1721
1822export 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 >
2330 </ Collapsible >
2431) ;
Original file line number Diff line number Diff line change @@ -2,12 +2,19 @@ import React from 'react';
22import styled from 'styled-components' ;
33import css from '@styled-system/css' ;
44import { 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+ ) ;
512
613export const Header = styled . div (
714 css ( {
815 display : 'flex' ,
916 alignItems : 'center' ,
10- height : '32px' ,
17+ height : 6 ,
1118 paddingX : 3 ,
1219 borderBottom : '1px solid' ,
1320 // Note: sideBarSectionHeader exists but we dont use it because it is rarely implemented
@@ -24,14 +31,6 @@ export const Header = styled.div(
2431 } )
2532) ;
2633
27- // temporary: replace with <Text variant="strong">
28- export const Title = styled . div (
29- css ( {
30- fontSize : 3 ,
31- fontWeight : 'semibold' ,
32- } )
33- ) ;
34-
3534// temporary: replace with <Icon name="triangle/toggle">
3635export const Icon = styled . svg < {
3736 open ?: boolean ;
@@ -82,12 +81,12 @@ export const Collapsible: React.FC<ICollapsibleProps> = ({
8281 const toggle = ( ) => setOpen ( ! open ) ;
8382
8483 return (
85- < Element as = "section" { ...props } >
84+ < Section { ...props } >
8685 < Header onClick = { toggle } >
8786 < ToggleIcon open = { open } />
88- < Title > { title } </ Title >
87+ < Text weight = "medium" > { title } </ Text >
8988 </ Header >
9089 { open ? < Body > { children } </ Body > : null }
91- </ Element >
90+ </ Section >
9291 ) ;
9392} ;
You can’t perform that action at this time.
0 commit comments