Compare commits

...

4 Commits

Author SHA1 Message Date
8cddeab594 v0.7.4 2021-03-31 14:40:22 +02:00
68939d8390 Fixed External link
Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
2021-03-31 14:38:33 +02:00
8186284ded GradientBackground is now stable
Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
2021-03-31 13:51:04 +02:00
e173bd2a37 Changed generated classes names to be shorter
Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
2021-03-31 10:48:48 +02:00
7 changed files with 25 additions and 29 deletions

View File

@ -1,6 +1,6 @@
{ {
"name": "@dzeio/components", "name": "@dzeio/components",
"version": "0.7.3", "version": "0.7.4",
"license": "MIT", "license": "MIT",
"main": "./index.js", "main": "./index.js",
"types": "./types/index.d.ts", "types": "./types/index.d.ts",

View File

@ -12,7 +12,9 @@ export default [
url: false, url: false,
autoModules: true, autoModules: true,
mode: 'extract', mode: 'extract',
modules: {
generateScopedName: '[hash:8]'
}
}), }),
typescript({useTsconfigDeclarationDir: true}), // so Rollup can convert TypeScript to JavaScript typescript({useTsconfigDeclarationDir: true}), // so Rollup can convert TypeScript to JavaScript
], ],

View File

@ -1,34 +1,29 @@
@import "../config" @import "../config"
$transparent = 75% $transparent = 15%
.back .back
transition all $transition transition all $transition
background linear-gradient(to left, $default, transparentify($default, $transparent)) background $mainGradient
.primary &.fullscreen
$color = $primary min-height 100vh
background linear-gradient(to left, $color, transparentify($color, $transparent))
.secondary
$color = $secondary
background linear-gradient(to left, $color, transparentify($color, $transparent))
.info .info
$color = $info $color = $info
background linear-gradient(to left, $color, transparentify($color, $transparent)) background linear-gradient(to left, $color, lighten($color, $transparent))
.success .success
$color = $success $color = $success
background linear-gradient(to left, $color, transparentify($color, $transparent)) background linear-gradient(to left, $color, lighten($color, $transparent))
.danger .danger
$color = $danger $color = $danger
background linear-gradient(to left, $color, transparentify($color, $transparent)) background linear-gradient(to left, $color, lighten($color, $transparent))
.warning .warning
$color = $warning $color = $warning
background linear-gradient(to left, $color, transparentify($color, $transparent)) background linear-gradient(to left, $color, lighten($color, $transparent))
@media (prefers-color-scheme dark) @media (prefers-color-scheme dark)
.back .back

View File

@ -8,12 +8,18 @@ interface Props {
color?: ColorType color?: ColorType
className?: string className?: string
children: React.ReactNode children: React.ReactNode
fullscreen?: boolean
} }
/**
* Make the background a linear-gradient
*
* @version 1.0.0
*/
export default class GradientBackground extends React.Component<Props> { export default class GradientBackground extends React.Component<Props> {
public render = () => ( public render = () => (
<div className={buildClassName([css.back], [css[this.props.color as string], this.props.color], [this.props.className])}> <div className={buildClassName(css.back, [css[this.props.color as string], this.props.color], this.props.className)}>
{this.props.children} {this.props.children}
</div> </div>
) )

View File

@ -24,7 +24,7 @@ interface Props {
export default class Link extends React.Component<Props> { export default class Link extends React.Component<Props> {
public render() { public render() {
const external = this.props.external ?? !this.props.href.startsWith('/') const external = this.props.external ?? this.props.href.startsWith('http')
if (external) { if (external) {
// external link // external link
return ( return (

View File

@ -12,7 +12,6 @@ interface Props {
export default class Text extends React.Component<Props> { export default class Text extends React.Component<Props> {
public render() { public render() {
const classes = buildClassName( const classes = buildClassName(
css.text, css.text,
@ -23,16 +22,10 @@ export default class Text extends React.Component<Props> {
this.props.className this.props.className
) )
switch (this.props.type || 'p') { if (this.props.type === 'em') {
case 'h1': return (<h1 className={classes}>{this.props.children}</h1>) return (<p className={classes}><em>{this.props.children}</em></p>)
case 'h2': return (<h2 className={classes}>{this.props.children}</h2>)
case 'h3': return (<h3 className={classes}>{this.props.children}</h3>)
case 'h4': return (<h4 className={classes}>{this.props.children}</h4>)
case 'h5': return (<h5 className={classes}>{this.props.children}</h5>)
case 'h6': return (<h6 className={classes}>{this.props.children}</h6>)
case 'em': return (<p className={classes}><em>{this.props.children}</em></p>)
case 'span': return (<span className={classes}>{this.props.children}</span>)
default: return (<p className={classes}>{this.props.children}</p>)
} }
return React.createElement(this.props.type || 'p', {className: classes})
} }
} }

View File

@ -1,6 +1,6 @@
import { SVGAttributes } from 'react' import { SVGAttributes } from 'react'
export type ColorType = 'primary' | 'info' | 'success' | 'error' | 'warning' export type ColorType = 'info' | 'success' | 'error' | 'warning'
export interface IconProps extends SVGAttributes<SVGElement> { export interface IconProps extends SVGAttributes<SVGElement> {
color?: string color?: string