mirror of
https://github.com/dzeiocom/components.git
synced 2025-04-23 19:32:14 +00:00
feat: Add sidePadding parameter to BoxHeader
Signed-off-by: Avior <github@avior.me>
This commit is contained in:
parent
45616b1e92
commit
47399da4e0
@ -11,6 +11,9 @@
|
|||||||
.header
|
.header
|
||||||
padding 16px
|
padding 16px
|
||||||
|
|
||||||
|
&.noSidePadding
|
||||||
|
padding 16px 0
|
||||||
|
|
||||||
+ .body
|
+ .body
|
||||||
padding-top 0
|
padding-top 0
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ import React from 'react'
|
|||||||
import Component from '.'
|
import Component from '.'
|
||||||
import Text from '../Text'
|
import Text from '../Text'
|
||||||
import { Lightbulb } from 'lucide-react'
|
import { Lightbulb } from 'lucide-react'
|
||||||
|
import BoxHeader from './BoxHeader'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
title: 'DZEIO/Box',
|
title: 'DZEIO/Box',
|
||||||
@ -22,5 +23,8 @@ export const Complete = (args: any) => (
|
|||||||
icon={Lightbulb}
|
icon={Lightbulb}
|
||||||
rightHeader={<Text>Test</Text>}
|
rightHeader={<Text>Test</Text>}
|
||||||
// {...args}
|
// {...args}
|
||||||
><Text>Test</Text></Component>
|
>
|
||||||
|
<Text>Test</Text>
|
||||||
|
<BoxHeader title="BoxHeader" />
|
||||||
|
</Component>
|
||||||
)
|
)
|
||||||
|
@ -5,10 +5,12 @@ import Row from '../Row'
|
|||||||
import Col from '../Col'
|
import Col from '../Col'
|
||||||
import Text from '../Text'
|
import Text from '../Text'
|
||||||
import { Icon } from '../interfaces'
|
import { Icon } from '../interfaces'
|
||||||
|
import { buildClassName } from '../Util'
|
||||||
|
|
||||||
interface Props extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
interface Props extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElement>, HTMLDivElement> {
|
||||||
title?: string
|
title?: string
|
||||||
icon?: Icon
|
icon?: Icon
|
||||||
|
sidePadding?: boolean
|
||||||
children?: React.ReactNode
|
children?: React.ReactNode
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19,7 +21,7 @@ interface Props extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElem
|
|||||||
*/
|
*/
|
||||||
export default class BoxHeader extends React.Component<Props> {
|
export default class BoxHeader extends React.Component<Props> {
|
||||||
public render = () => (
|
public render = () => (
|
||||||
<div className={css.header}>
|
<div className={buildClassName(css.header, [css.noSidePadding, !this.props.sidePadding])}>
|
||||||
<Row justify="space-between">
|
<Row justify="space-between">
|
||||||
<Col>
|
<Col>
|
||||||
<Text className={css.title} weight="bold">
|
<Text className={css.title} weight="bold">
|
||||||
|
@ -30,7 +30,7 @@ export default class Box extends React.Component<Props> {
|
|||||||
className={buildClassName(css.box, this.props?.className, [css.noBottomBorder, this.props.noBottomBorder])}
|
className={buildClassName(css.box, this.props?.className, [css.noBottomBorder, this.props.noBottomBorder])}
|
||||||
>
|
>
|
||||||
{(this.props.rightHeader || this.props.title || this.props.icon) && (
|
{(this.props.rightHeader || this.props.title || this.props.icon) && (
|
||||||
<BoxHeader title={this.props.title} icon={this.props.icon}>{this.props.rightHeader}</BoxHeader>
|
<BoxHeader title={this.props.title} sidePadding icon={this.props.icon}>{this.props.rightHeader}</BoxHeader>
|
||||||
)}
|
)}
|
||||||
{this.props.children && (
|
{this.props.children && (
|
||||||
<div className={buildClassName([css.body, !this.props.noPadding])}>
|
<div className={buildClassName([css.body, !this.props.noPadding])}>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user