mirror of
https://github.com/dzeiocom/components.git
synced 2025-04-23 03:12:14 +00:00
Added three new components
Signed-off-by: Avior <github@avior.me>
This commit is contained in:
parent
496bafa0e4
commit
32ea3b958f
11
.github/workflows/build.yml
vendored
11
.github/workflows/build.yml
vendored
@ -27,14 +27,3 @@ jobs:
|
|||||||
|
|
||||||
- name: Build components
|
- name: Build components
|
||||||
run: npm run build
|
run: npm run build
|
||||||
|
|
||||||
- uses: sonarsource/sonarcloud-github-action@master
|
|
||||||
with:
|
|
||||||
args: >
|
|
||||||
-Dsonar.organization=dzeio
|
|
||||||
-Dsonar.projectKey=dzeiocom_components
|
|
||||||
-Dsonar.sources=.
|
|
||||||
-Dsonar.sourceEncoding=UTF-8
|
|
||||||
env:
|
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
|
37
.github/workflows/ossar-analysis.yml
vendored
Normal file
37
.github/workflows/ossar-analysis.yml
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
# This workflow uses actions that are not certified by GitHub.
|
||||||
|
# They are provided by a third-party and are governed by
|
||||||
|
# separate terms of service, privacy policy, and support
|
||||||
|
# documentation.
|
||||||
|
|
||||||
|
# This workflow integrates a collection of open source static analysis tools
|
||||||
|
# with GitHub code scanning. For documentation, or to provide feedback, visit
|
||||||
|
# https://github.com/github/ossar-action
|
||||||
|
name: OSSAR
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [ master ]
|
||||||
|
pull_request:
|
||||||
|
# The branches below must be a subset of the branches above
|
||||||
|
branches: [ master ]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
OSSAR-Scan:
|
||||||
|
# OSSAR runs on windows-latest.
|
||||||
|
# ubuntu-latest and macos-latest support coming soon
|
||||||
|
runs-on: windows-latest
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
|
||||||
|
# Run open source static analysis tools
|
||||||
|
- name: Run OSSAR
|
||||||
|
uses: github/ossar-action@v1
|
||||||
|
id: ossar
|
||||||
|
|
||||||
|
# Upload results to the Security tab
|
||||||
|
- name: Upload OSSAR results
|
||||||
|
uses: github/codeql-action/upload-sarif@v1
|
||||||
|
with:
|
||||||
|
sarif_file: ${{ steps.ossar.outputs.sarifFile }}
|
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "@dzeio/components",
|
"name": "@dzeio/components",
|
||||||
"version": "1.0.0-alpha.5",
|
"version": "1.0.0-alpha.6",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "@dzeio/components",
|
"name": "@dzeio/components",
|
||||||
"version": "1.0.0-alpha.5",
|
"version": "1.0.0-alpha.6",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
@ -5,6 +5,8 @@
|
|||||||
@media (prefers-color-scheme dark)
|
@media (prefers-color-scheme dark)
|
||||||
background $foregroundDark
|
background $foregroundDark
|
||||||
border-radius 16px
|
border-radius 16px
|
||||||
|
&.noBottomBorder
|
||||||
|
border-radius 16px 16px 0 0
|
||||||
|
|
||||||
.header
|
.header
|
||||||
padding 16px
|
padding 16px
|
||||||
|
@ -12,6 +12,11 @@ interface Props extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElem
|
|||||||
children?: React.ReactNode
|
children?: React.ReactNode
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The box header that caan be used out of a box
|
||||||
|
*
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
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={css.header}>
|
||||||
|
@ -14,13 +14,20 @@ interface Props extends React.DetailedHTMLProps<React.HTMLAttributes<HTMLDivElem
|
|||||||
title?: string
|
title?: string
|
||||||
icon?: Icon
|
icon?: Icon
|
||||||
rightHeader?: React.ReactNode
|
rightHeader?: React.ReactNode
|
||||||
|
|
||||||
|
noBottomBorder?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The basic Box Component
|
||||||
|
*
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
export default class Box extends React.Component<Props> {
|
export default class Box extends React.Component<Props> {
|
||||||
public render = () => (
|
public render = () => (
|
||||||
<div
|
<div
|
||||||
{...objectOmit<Record<string, any>>(this.props, 'title', 'icon', 'rightHeader', 'noPadding')}
|
{...objectOmit<Record<string, any>>(this.props, 'title', 'icon', 'rightHeader', 'noPadding')}
|
||||||
className={buildClassName(css.box, this.props?.className)}
|
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} icon={this.props.icon}>{this.props.rightHeader}</BoxHeader>
|
||||||
|
16
src/Breadcrumb/Breadcrumb.module.styl
Normal file
16
src/Breadcrumb/Breadcrumb.module.styl
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
.breadcrumb ol
|
||||||
|
display flex
|
||||||
|
display inline-flex
|
||||||
|
padding 0
|
||||||
|
margin 0
|
||||||
|
align-items center
|
||||||
|
flex-wrap wrap
|
||||||
|
li
|
||||||
|
display inline-block
|
||||||
|
&:first-child .item
|
||||||
|
padding-left 0
|
||||||
|
&:last-child .item
|
||||||
|
padding-right 0
|
||||||
|
|
||||||
|
.item
|
||||||
|
padding 0 16px
|
20
src/Breadcrumb/Breadcrumb.stories.tsx
Normal file
20
src/Breadcrumb/Breadcrumb.stories.tsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { Meta } from '@storybook/react/types-6-0'
|
||||||
|
import React from 'react'
|
||||||
|
import { Zap } from 'lucide-react'
|
||||||
|
import Box from '../Box'
|
||||||
|
import Component from '.'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: 'DZEIO/Breadcrumb',
|
||||||
|
component: Component
|
||||||
|
} as Meta
|
||||||
|
|
||||||
|
export const Breadcrumb = (args: any) => <Box><Component {...args}>Button</Component></Box>
|
||||||
|
Breadcrumb.args = {
|
||||||
|
items: [{
|
||||||
|
display: "Pouet",
|
||||||
|
href: '/pouet'
|
||||||
|
}, {
|
||||||
|
display: "Pouet",
|
||||||
|
}]
|
||||||
|
}
|
49
src/Breadcrumb/index.tsx
Normal file
49
src/Breadcrumb/index.tsx
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import Link from '../Link'
|
||||||
|
import Text from '../Text'
|
||||||
|
import css from './Breadcrumb.module.styl'
|
||||||
|
import { ChevronRight, Home } from 'lucide-react'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
items: Array<{
|
||||||
|
display: string
|
||||||
|
href?: string
|
||||||
|
}>
|
||||||
|
|
||||||
|
textProps?: Text['props']
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A breadcrumb compatible with Schema.org BreadcrumbList type
|
||||||
|
*
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
export default class Breadcrumb extends React.Component<Props> {
|
||||||
|
|
||||||
|
public render() {
|
||||||
|
return (
|
||||||
|
<nav className={css.breadcrumb}>
|
||||||
|
<ol vocab="https://schema.org/" typeof="BreadcrumbList">
|
||||||
|
<li>
|
||||||
|
<Link className={css.item} href="/" noStyle>
|
||||||
|
<Text {...this.props.textProps} tag="span"><Home size={16} /></Text>
|
||||||
|
</Link>
|
||||||
|
</li>
|
||||||
|
{this.props.items.map((el, index) => (
|
||||||
|
<li property="itemListElement" typeof="ListItem" key={index}>
|
||||||
|
<Text {...this.props.textProps} tag="span"><ChevronRight size={14} /></Text>
|
||||||
|
{el.href ? (
|
||||||
|
<Link className={css.item} noStyle href={el.href.replace(/ /g, '-')} linkProps={{ property: "item", typeof: "WebPage" }}>
|
||||||
|
<Text {...this.props.textProps} tag="span" textProps={{ property: "name" }}>{el.display}</Text>
|
||||||
|
</Link>
|
||||||
|
) : (
|
||||||
|
<Text className={css.item} {...this.props.textProps} tag="span" weight="bold" textProps={{ property: "name" }}>{el.display}</Text>
|
||||||
|
)}
|
||||||
|
<meta property="position" content={index.toString()} />
|
||||||
|
</li>
|
||||||
|
))}
|
||||||
|
</ol>
|
||||||
|
</nav>
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
@ -4,16 +4,11 @@
|
|||||||
position fixed
|
position fixed
|
||||||
left 0
|
left 0
|
||||||
width 100%
|
width 100%
|
||||||
height 7px
|
|
||||||
pointer-events none
|
pointer-events none
|
||||||
z-index 200
|
z-index 200
|
||||||
|
transition top .5s ease-in-out
|
||||||
|
|
||||||
top 0
|
top 0
|
||||||
|
|
||||||
&.hide
|
&.hide
|
||||||
transition top .5s ease-in-out
|
|
||||||
top -7px
|
top -7px
|
||||||
div
|
|
||||||
&:not([style="width: 0px;"])
|
|
||||||
transition width 50ms ease-in-out
|
|
||||||
background rgba($main, .7)
|
|
||||||
height 100%
|
|
||||||
|
@ -8,14 +8,10 @@ export default {
|
|||||||
component: Component,
|
component: Component,
|
||||||
parameters: {
|
parameters: {
|
||||||
layout: 'fullscreen'
|
layout: 'fullscreen'
|
||||||
}
|
},
|
||||||
|
argTypes: {
|
||||||
|
percent: { control: 'number'}
|
||||||
|
},
|
||||||
} as Meta
|
} as Meta
|
||||||
|
|
||||||
export const Loader: Story<any> = (args: any) => <Component {...args} />
|
export const Loader: Story<any> = (args: any) => <Component {...args} />
|
||||||
|
|
||||||
let tmp = Loader.bind({})
|
|
||||||
tmp.args = {
|
|
||||||
auto: {interval : [10, 100], increment: [0, 5]}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const Auto = tmp
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import { Router } from 'next/router'
|
import { Router } from 'next/router'
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
|
import ProgressBar from '../ProgressBar'
|
||||||
import { buildClassName } from '../Util'
|
import { buildClassName } from '../Util'
|
||||||
import css from './Loader.module.styl'
|
import css from './Loader.module.styl'
|
||||||
|
|
||||||
@ -42,6 +43,7 @@ export default class Loader extends React.Component<Props, State> {
|
|||||||
public componentDidMount() {
|
public componentDidMount() {
|
||||||
if (this.props.auto) {
|
if (this.props.auto) {
|
||||||
Router.events.on('routeChangeComplete', this.routeChangeComplete)
|
Router.events.on('routeChangeComplete', this.routeChangeComplete)
|
||||||
|
Router.events.on('routeChangeError', this.routeChangeComplete)
|
||||||
Router.events.on('routeChangeStart', this.routeChangeStart)
|
Router.events.on('routeChangeStart', this.routeChangeStart)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -49,15 +51,16 @@ export default class Loader extends React.Component<Props, State> {
|
|||||||
public componentWillUnmount() {
|
public componentWillUnmount() {
|
||||||
if (this.props.auto) {
|
if (this.props.auto) {
|
||||||
Router.events.off('routeChangeComplete', this.routeChangeComplete)
|
Router.events.off('routeChangeComplete', this.routeChangeComplete)
|
||||||
|
Router.events.off('routeChangeError', this.routeChangeComplete)
|
||||||
Router.events.off('routeChangeStart', this.routeChangeStart)
|
Router.events.off('routeChangeStart', this.routeChangeStart)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public render = () => (
|
public render = () => <ProgressBar
|
||||||
<div className={buildClassName(css.div, [css.hide, (this.props.percent || this.state.percent) === 100])}>
|
noRoundBorders
|
||||||
<div style={{width: (this.props.percent || this.state.percent) ? `${(this.props.percent || this.state.percent)}%` : 0}}></div>
|
progress={this.props.percent ?? this.state.percent ?? 0}
|
||||||
</div>
|
className={buildClassName(css.div, [css.hide, (this.props.percent ?? this.state.percent) === 100 || (this.props.percent ?? this.state.percent ?? 0) === 0])}
|
||||||
)
|
/>
|
||||||
|
|
||||||
private routeChangeComplete = () => {
|
private routeChangeComplete = () => {
|
||||||
if (this.interval) {
|
if (this.interval) {
|
||||||
|
24
src/ProgressBar/ProgressBar.module.styl
Normal file
24
src/ProgressBar/ProgressBar.module.styl
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
@import '../config'
|
||||||
|
|
||||||
|
.bar
|
||||||
|
width 100%
|
||||||
|
background rgba($main, .15)
|
||||||
|
height 8px
|
||||||
|
border-radius 8px
|
||||||
|
|
||||||
|
&.noBorder
|
||||||
|
border-radius 0
|
||||||
|
div
|
||||||
|
|
||||||
|
border-radius 0px 8px 8px 0px
|
||||||
|
&[style="width: 100%;"]
|
||||||
|
border-radius 0
|
||||||
|
|
||||||
|
div
|
||||||
|
transition width,border-radius
|
||||||
|
transition-duration $transitionTime
|
||||||
|
transition-timing-function $transitionFunction
|
||||||
|
height 100%
|
||||||
|
width 0
|
||||||
|
background $main
|
||||||
|
border-radius 8px
|
19
src/ProgressBar/ProgressBar.stories.tsx
Normal file
19
src/ProgressBar/ProgressBar.stories.tsx
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
import { Meta } from '@storybook/react/types-6-0'
|
||||||
|
import React from 'react'
|
||||||
|
import Component from '.'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: 'DZEIO/Progress Bar',
|
||||||
|
component: Component,
|
||||||
|
argTypes: {
|
||||||
|
progress: { control: 'number', defaultValue: 0},
|
||||||
|
noRoundBorders: { control: 'boolean'},
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
layout: 'fullscreen'
|
||||||
|
}
|
||||||
|
} as Meta
|
||||||
|
|
||||||
|
export const ProgressBar = (args: any) => (
|
||||||
|
<Component {...args} />
|
||||||
|
)
|
29
src/ProgressBar/index.tsx
Normal file
29
src/ProgressBar/index.tsx
Normal file
@ -0,0 +1,29 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { buildClassName } from '../Util'
|
||||||
|
import css from './ProgressBar.module.styl'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
/**
|
||||||
|
* Number between 0 and 100%
|
||||||
|
*/
|
||||||
|
progress: number
|
||||||
|
/**
|
||||||
|
* disable the round borders
|
||||||
|
*/
|
||||||
|
noRoundBorders?: boolean
|
||||||
|
className?: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a simple customizable Progress bar
|
||||||
|
*
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
export default class extends React.PureComponent<Props> {
|
||||||
|
|
||||||
|
public render = () => (
|
||||||
|
<div className={buildClassName(css.bar, [css.noBorder, this.props.noRoundBorders], this.props.className)}>
|
||||||
|
<div style={{ width: `${this.props.progress}%`}}></div>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
4
src/ProgressBox/ProgressBox.module.styl
Normal file
4
src/ProgressBox/ProgressBox.module.styl
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
@import '../config'
|
||||||
|
|
||||||
|
.padding
|
||||||
|
padding 24px
|
20
src/ProgressBox/ProgressBox.stories.tsx
Normal file
20
src/ProgressBox/ProgressBox.stories.tsx
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
import { Meta } from '@storybook/react/types-6-0'
|
||||||
|
import React from 'react'
|
||||||
|
import Component from '.'
|
||||||
|
|
||||||
|
export default {
|
||||||
|
title: 'DZEIO/Progress Box',
|
||||||
|
component: Component,
|
||||||
|
argTypes: {
|
||||||
|
progress: { control: 'number', defaultValue: 0},
|
||||||
|
text: { control: 'text'},
|
||||||
|
textProgress: { control: 'text'},
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
layout: 'fullscreen'
|
||||||
|
}
|
||||||
|
} as Meta
|
||||||
|
|
||||||
|
export const ProgressBox = (args: any) => (
|
||||||
|
<Component {...args} />
|
||||||
|
)
|
50
src/ProgressBox/index.tsx
Normal file
50
src/ProgressBox/index.tsx
Normal file
@ -0,0 +1,50 @@
|
|||||||
|
import React from 'react'
|
||||||
|
import { buildClassName } from '../Util'
|
||||||
|
import css from './ProgressBox.module.styl'
|
||||||
|
import ProgressBar from '../ProgressBar'
|
||||||
|
import Row from '../Row'
|
||||||
|
import Col from '../Col'
|
||||||
|
import Text from '../Text'
|
||||||
|
import Box from '../Box'
|
||||||
|
|
||||||
|
interface Props {
|
||||||
|
/**
|
||||||
|
* Number between 0 and 100%
|
||||||
|
*/
|
||||||
|
progress: number
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Text displayed in the middle
|
||||||
|
*/
|
||||||
|
text: string
|
||||||
|
|
||||||
|
/**
|
||||||
|
* text displayed in the right of the box
|
||||||
|
*/
|
||||||
|
textProgress: string
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display a simple Progress box that can be used for multiple things
|
||||||
|
*
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
|
export default class extends React.PureComponent<Props> {
|
||||||
|
|
||||||
|
public render = () => (
|
||||||
|
<Box noPadding noBottomBorder>
|
||||||
|
<Row className={css.padding}>
|
||||||
|
<Col nogrow>
|
||||||
|
<Text color="main">{this.props.progress}%</Text>
|
||||||
|
</Col>
|
||||||
|
<Col>
|
||||||
|
<Text weight="bold" align="center">{this.props.text}</Text>
|
||||||
|
</Col>
|
||||||
|
<Col nogrow>
|
||||||
|
<Text color="main">{this.props.textProgress}</Text>
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
<ProgressBar noRoundBorders progress={this.props.progress} />
|
||||||
|
</Box>
|
||||||
|
)
|
||||||
|
}
|
@ -10,7 +10,7 @@ export default {
|
|||||||
} as Meta
|
} as Meta
|
||||||
|
|
||||||
export const Table = (args: any) => (
|
export const Table = (args: any) => (
|
||||||
<Box icon={Settings} title="Storage">
|
<Box icon={Settings} title="Table">
|
||||||
<Component {...args}>
|
<Component {...args}>
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
|
@ -14,6 +14,9 @@
|
|||||||
.black
|
.black
|
||||||
color #212121
|
color #212121
|
||||||
|
|
||||||
|
.main
|
||||||
|
color $main
|
||||||
|
|
||||||
for size in 36 28 24 20 18 16 14
|
for size in 36 28 24 20 18 16 14
|
||||||
.size-{size}
|
.size-{size}
|
||||||
font-size rem(size)
|
font-size rem(size)
|
||||||
|
@ -5,7 +5,7 @@ import css from './Text.module.styl'
|
|||||||
type Types = 'hero' | 'h1' | 'h2' | 'h3' | 'h4' | 'text' | 'light' | 'bold'
|
type Types = 'hero' | 'h1' | 'h2' | 'h3' | 'h4' | 'text' | 'light' | 'bold'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
color?: 'black' | 'white' | 'none'
|
color?: 'black' | 'white' | 'none' | 'main'
|
||||||
type?: Types
|
type?: Types
|
||||||
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'em' | 'span' | 'div'
|
tag?: 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6' | 'p' | 'em' | 'span' | 'div'
|
||||||
weight?: 'normal' | 'bold' | 'light'
|
weight?: 'normal' | 'bold' | 'light'
|
||||||
@ -14,6 +14,7 @@ interface Props {
|
|||||||
noDarkTheme?: boolean
|
noDarkTheme?: boolean
|
||||||
align?: 'left' | 'right' | 'center'
|
align?: 'left' | 'right' | 'center'
|
||||||
children: React.ReactNode
|
children: React.ReactNode
|
||||||
|
textProps?: React.DetailedHTMLProps<React.AnchorHTMLAttributes<HTMLElement>, HTMLElement>
|
||||||
}
|
}
|
||||||
|
|
||||||
const types: Record<Types, {
|
const types: Record<Types, {
|
||||||
@ -55,6 +56,11 @@ const types: Record<Types, {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Display Text lol
|
||||||
|
*
|
||||||
|
* @version 1.0.0
|
||||||
|
*/
|
||||||
export default class Text extends React.PureComponent<Props> {
|
export default class Text extends React.PureComponent<Props> {
|
||||||
|
|
||||||
public render() {
|
public render() {
|
||||||
@ -70,10 +76,9 @@ export default class Text extends React.PureComponent<Props> {
|
|||||||
}
|
}
|
||||||
const classes = buildClassName(
|
const classes = buildClassName(
|
||||||
css.text,
|
css.text,
|
||||||
|
css[this.props.color ?? 'black'],
|
||||||
[css[`weight-${data.weight}`], data.weight !== 'normal'],
|
[css[`weight-${data.weight}`], data.weight !== 'normal'],
|
||||||
[css[`size-${data.size}`], data.size !== 16],
|
[css[`size-${data.size}`], data.size !== 16],
|
||||||
[css.white, this.props.color === 'white'],
|
|
||||||
[css.black, this.props.color === 'black' || !this.props.color],
|
|
||||||
[css.noDarkTheme, this.props.noDarkTheme],
|
[css.noDarkTheme, this.props.noDarkTheme],
|
||||||
[css[`align-${this.props.align}`], this.props.align],
|
[css[`align-${this.props.align}`], this.props.align],
|
||||||
this.props.className
|
this.props.className
|
||||||
@ -83,6 +88,6 @@ export default class Text extends React.PureComponent<Props> {
|
|||||||
return (<p className={classes}><em>{this.props.children}</em></p>)
|
return (<p className={classes}><em>{this.props.children}</em></p>)
|
||||||
}
|
}
|
||||||
|
|
||||||
return React.createElement(this.props.tag ?? data.tag ?? 'p', {className: classes, children: this.props.children})
|
return React.createElement(this.props.tag ?? data.tag ?? 'p', {...this.props.textProps, className: classes, children: this.props.children})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import './general.styl'
|
|||||||
|
|
||||||
import Box from './Box'
|
import Box from './Box'
|
||||||
import BoxHeader from './Box/BoxHeader'
|
import BoxHeader from './Box/BoxHeader'
|
||||||
|
import Breadcrumb from './Breadcrumb'
|
||||||
import Button from './Button'
|
import Button from './Button'
|
||||||
import Checkbox from './Checkbox'
|
import Checkbox from './Checkbox'
|
||||||
import Code from './Code'
|
import Code from './Code'
|
||||||
@ -21,6 +22,8 @@ import Menu from './Menu'
|
|||||||
import Navbar from './Navbar'
|
import Navbar from './Navbar'
|
||||||
import NotificationManager from './NotificationManager'
|
import NotificationManager from './NotificationManager'
|
||||||
import Popup from './Popup'
|
import Popup from './Popup'
|
||||||
|
import ProgressBar from './ProgressBar'
|
||||||
|
import ProgressBox from './ProgressBox'
|
||||||
import Row from './Row'
|
import Row from './Row'
|
||||||
import Sidebar from './Sidebar'
|
import Sidebar from './Sidebar'
|
||||||
import Table from './Table'
|
import Table from './Table'
|
||||||
@ -30,6 +33,7 @@ import * as Util from './Util'
|
|||||||
export {
|
export {
|
||||||
Box,
|
Box,
|
||||||
BoxHeader,
|
BoxHeader,
|
||||||
|
Breadcrumb,
|
||||||
Button,
|
Button,
|
||||||
Checkbox,
|
Checkbox,
|
||||||
Code,
|
Code,
|
||||||
@ -45,6 +49,8 @@ export {
|
|||||||
Navbar,
|
Navbar,
|
||||||
NotificationManager,
|
NotificationManager,
|
||||||
Popup,
|
Popup,
|
||||||
|
ProgressBar,
|
||||||
|
ProgressBox,
|
||||||
Row,
|
Row,
|
||||||
Sidebar,
|
Sidebar,
|
||||||
Table,
|
Table,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user