File tree Expand file tree Collapse file tree 10 files changed +285
-0
lines changed Expand file tree Collapse file tree 10 files changed +285
-0
lines changed Original file line number Diff line number Diff line change 1+ import { Layer } from 'grommet'
2+ import { Div , Flex , Span } from 'honorable'
3+
4+ import { Card , CloseIcon , IconFrame } from '../index'
5+
6+ export default function InfoPanel ( {
7+ title,
8+ onClose = ( ) => { } ,
9+ width = 420 ,
10+ marginTop = '0' ,
11+ contentHeight = 300 ,
12+ contentPadding = 0 ,
13+ contentGap = 0 ,
14+ children,
15+ } : {
16+ title : string
17+ onClose ?: ( ) => void
18+ width ?: number | string
19+ marginTop ?: string
20+ contentHeight ?: number | string
21+ contentPadding ?: number | string
22+ contentGap ?: number | string
23+ children ?: JSX . Element | JSX . Element [ ] | string
24+ } ) {
25+ return (
26+ < Layer
27+ plain
28+ onClickOutside = { onClose }
29+ position = "top-right"
30+ margin = { { top : marginTop } }
31+ >
32+ < Card
33+ fillLevel = { 2 }
34+ width = { width }
35+ overflow = "hidden"
36+ margin = "large"
37+ >
38+ < Div
39+ padding = "medium"
40+ borderBottom = "1px solid border-fill-two"
41+ >
42+ < Flex
43+ align = "center"
44+ justify = "space-between"
45+ >
46+ < Span
47+ fontSize = { 18 }
48+ fontWeight = { 500 }
49+ lineHeight = "24px"
50+ >
51+ { title }
52+ </ Span >
53+ < IconFrame
54+ clickable
55+ icon = { < CloseIcon /> }
56+ onClick = { ( ) => onClose ( ) }
57+ />
58+ </ Flex >
59+ </ Div >
60+ < Flex
61+ direction = "column"
62+ overflowY = "auto"
63+ gap = { contentGap }
64+ padding = { contentPadding }
65+ height = { contentHeight }
66+ >
67+ { children }
68+ </ Flex >
69+ </ Card >
70+ </ Layer >
71+ )
72+ }
Original file line number Diff line number Diff line change 1+ import { Div , type DivProps } from 'honorable'
2+ import styled from 'styled-components'
3+
4+ const PropSC = styled . div ( ( { theme } ) => ( {
5+ margin : theme . spacing . medium ,
6+
7+ '.prop-title' : {
8+ ...theme . partials . text . caption ,
9+ color : theme . colors [ 'text-xlight' ] ,
10+ marginBottom : theme . spacing . xxsmall ,
11+ } ,
12+ } ) )
13+
14+ export default function Prop ( {
15+ children,
16+ title,
17+ ...props
18+ } : {
19+ title : string
20+ } & DivProps ) {
21+ return (
22+ < PropSC >
23+ < div className = "prop-title" > { title } </ div >
24+ < Div { ...props } > { children } </ Div >
25+ </ PropSC >
26+ )
27+ }
Original file line number Diff line number Diff line change 1+ import { Flex , type FlexProps } from 'honorable'
2+ import styled from 'styled-components'
3+
4+ import { Divider } from '../index'
5+
6+ const PropWideSC = styled . div ( ( { theme } ) => ( {
7+ alignItems : 'center' ,
8+ display : 'flex' ,
9+ gap : theme . spacing . small ,
10+ marginVertical : theme . spacing . small ,
11+
12+ '.prop-title' : {
13+ ...theme . partials . text . overline ,
14+ color : theme . colors [ 'text-xlight' ] ,
15+ display : 'flex' ,
16+ } ,
17+ } ) )
18+
19+ export default function PropWide ( {
20+ children,
21+ title,
22+ ...props
23+ } : {
24+ title : string
25+ } & FlexProps ) {
26+ return (
27+ < PropWideSC >
28+ < div className = "prop-title" > { title } </ div >
29+ < Divider
30+ backgroundColor = "border-fill-three"
31+ flexGrow = { 1 }
32+ />
33+ < Flex { ...props } > { children } </ Flex >
34+ </ PropWideSC >
35+ )
36+ }
Original file line number Diff line number Diff line change 1+ import { Div , type DivProps } from 'honorable'
2+ import styled from 'styled-components'
3+
4+ const PropsContainerSC = styled ( Div ) ( ( { theme } ) => ( {
5+ border : theme . borders . default ,
6+ borderRadius : theme . borderRadiuses . medium ,
7+
8+ '.container-title' : {
9+ ...theme . partials . text . overline ,
10+ color : theme . colors [ 'text-xlight' ] ,
11+ margin : theme . spacing . medium ,
12+ } ,
13+ } ) )
14+
15+ export default function PropsContainer ( {
16+ children,
17+ title,
18+ ...props
19+ } : {
20+ title : string
21+ } & DivProps ) {
22+ return (
23+ < PropsContainerSC { ...props } >
24+ { title && < div className = "container-title" > { title } </ div > }
25+ { children }
26+ </ PropsContainerSC >
27+ )
28+ }
Original file line number Diff line number Diff line change 1+ import styled from 'styled-components'
2+
3+ import { AppIcon } from '../index'
4+
5+ const UserDetailsSC = styled . div ( ( { theme } ) => ( {
6+ alignItems : 'center' ,
7+ display : 'flex' ,
8+ gap : theme . spacing . xsmall ,
9+ whiteSpace : 'nowrap' ,
10+
11+ '.name' : {
12+ ...theme . partials . text . body2 ,
13+ } ,
14+
15+ '.email' : {
16+ ...theme . partials . text . caption ,
17+ color : theme . colors [ 'text-xlight' ] ,
18+ display : 'flex' ,
19+ overflow : 'hidden' ,
20+ textOverflow : 'ellipsis' ,
21+ } ,
22+ } ) )
23+
24+ export default function UserDetails ( {
25+ name,
26+ email,
27+ avatar,
28+ } : {
29+ name ?: string | null
30+ email ?: string | null
31+ avatar ?: string | null
32+ } ) {
33+ return (
34+ < UserDetailsSC >
35+ < AppIcon
36+ name = { name || '' }
37+ url = { avatar || undefined }
38+ size = "xxsmall"
39+ />
40+ < div >
41+ < div className = "name" > { name } </ div >
42+ { email && < div className = "email" > { email } </ div > }
43+ </ div >
44+ </ UserDetailsSC >
45+ )
46+ }
Original file line number Diff line number Diff line change @@ -32,6 +32,11 @@ export type { PageCardProps } from './components/PageCard'
3232export { default as PageCard } from './components/PageCard'
3333export { default as PageTitle } from './components/PageTitle'
3434export { default as ProgressBar } from './components/ProgressBar'
35+ export { default as Prop } from './components/Prop'
36+ export { default as PropWide } from './components/PropWide'
37+ export { default as PropsContainer } from './components/PropsContainer'
38+ export { default as InfoPanel } from './components/InfoPanel'
39+ export { default as UserDetails } from './components/UserDetails'
3540export { default as Radio } from './components/Radio'
3641export { default as RadioGroup } from './components/RadioGroup'
3742export { default as AppIcon } from './components/AppIcon'
Original file line number Diff line number Diff line change 1+ import { Prop } from '../index'
2+
3+ export default {
4+ title : 'Prop' ,
5+ component : Prop ,
6+ }
7+
8+ function Template ( ) {
9+ return < Prop title = "Name" > Test</ Prop >
10+ }
11+
12+ export const Default = Template . bind ( { } )
13+ Default . args = { }
Original file line number Diff line number Diff line change 1+ import { PropWide } from '../index'
2+
3+ export default {
4+ title : 'Prop Wide' ,
5+ component : PropWide ,
6+ }
7+
8+ function Template ( ) {
9+ return < PropWide title = "Name" > Test</ PropWide >
10+ }
11+
12+ export const Default = Template . bind ( { } )
13+ Default . args = { }
Original file line number Diff line number Diff line change 1+ import { Prop , PropsContainer , UserDetails } from '../index'
2+
3+ export default {
4+ title : 'Props Container' ,
5+ component : PropsContainer ,
6+ }
7+
8+ function Template ( ) {
9+ return (
10+ < PropsContainer
11+ title = "Metadata"
12+ width = { 200 }
13+ >
14+ < Prop title = "Name" > Test</ Prop >
15+ < Prop title = "Date" > 10 minutes ago</ Prop >
16+ < Prop title = "Owner" >
17+ < UserDetails
18+ name = "Test"
19+ 20+ />
21+ </ Prop >
22+ </ PropsContainer >
23+ )
24+ }
25+
26+ export const Default = Template . bind ( { } )
27+ Default . args = { }
Original file line number Diff line number Diff line change 1+ import { UserDetails } from '../index'
2+
3+ export default {
4+ title : 'User Details' ,
5+ component : UserDetails ,
6+ }
7+
8+ function Template ( ) {
9+ return (
10+ < UserDetails
11+ name = "Test"
12+ 13+ />
14+ )
15+ }
16+
17+ export const Default = Template . bind ( { } )
18+ Default . args = { }
You can’t perform that action at this time.
0 commit comments