Compare commits

...

12 Commits

Author SHA1 Message Date
48d60f60e0 v0.9.2 2021-05-02 23:19:54 +02:00
d49c194654 Updated Table to use Light/Dark themes
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
2021-05-02 23:19:33 +02:00
6f1c366289 v0.9.1 2021-05-01 23:35:11 +02:00
8ac899b3f0 Added HideExternal to links
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
2021-05-01 23:34:45 +02:00
7ddce9ec85 v0.9.0 2021-05-01 23:02:53 +02:00
f3597f3008 Added Socials to Footer
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
2021-05-01 23:01:02 +02:00
fe6b552a69 add margin when multiple Text elements are next to each others (#5)
Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
2021-05-01 22:58:40 +02:00
58a48b28fd Merge branch 'master' of https://github.com/dzeiocom/components 2021-04-26 11:07:11 +02:00
5675d8f225 Updated Box to be a single component
Signed-off-by: Avior <florian.bouillon@delta-wings.net>
2021-04-22 23:08:04 +02:00
0f7999ac50 v0.8.6 2021-04-16 11:11:07 +02:00
d43e62f04a Fixed Notification being behind Sidebar
Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
2021-04-16 11:09:55 +02:00
c680b613cc Swaped Colors for invalid Inputs
Signed-off-by: Florian BOUILLON <florian.bouillon@delta-wings.net>
2021-04-15 11:34:17 +02:00
16 changed files with 120 additions and 96 deletions

View File

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

View File

@ -12,6 +12,22 @@
border-color $grayLight border-color $grayLight
.header
padding 16px
+ .body
padding-top 0
.title
font-weight bold
font-size rem(18)
margin 0 0 8px
.subtitle
font-size rem(16)
margin 0
// BODY // BODY
.body .body
padding 0 16px 16px padding 16px

View File

@ -1,13 +0,0 @@
@import "../../config.styl"
.header
padding 16px
.title
font-weight bold
font-size rem(18)
margin 0 0 8px
.subtitle
font-size rem(16)
margin 0

View File

@ -1,56 +0,0 @@
import React from 'react'
import { buildClassName } from '../../Util'
import css from './BoxHeader.module.styl'
import Row from '../../Row'
import Col from '../../Col'
import Text from '../../Text'
export interface Props {
title?: string
titleColSize?: number
subtitle?: string
titleClassName?: string
}
export default class BoxHeader extends React.Component<Props> {
public render = () => (
<>
<div data-t="true" className={buildClassName(
css.header
)}>
<Row nomargin justify="space-between">
<Col>
{this.props.title && (
<Text className={buildClassName(css.title, this.props.titleClassName)}>{this.props.title}</Text>
)}
{this.props.subtitle && (
<Text className={css.subtitle}>{this.props.subtitle}</Text>
)}
</Col>
{this.props.children && (
<Col nogrow>
<Row justify="flex-end">
{this.props.children}
</Row>
</Col>
)}
</Row>
</div>
</>
)
}
/*
Header
delimiter?: boolean
picture?: string // url
category?: string // subtitle but above title
title string
subtitle string
center?: boolean // if Center children is not used
children?: content
*/

View File

@ -1,9 +1,11 @@
import React from 'react' import React from 'react'
import BoxHeader from './BoxHeader'
import { buildClassName } from '../Util' import { buildClassName } from '../Util'
import css from './Box.module.styl' import css from './Box.module.styl'
import Row from '../Row'
import Col from '../Col'
import Text from '../Text'
interface Props { interface Props {
@ -37,14 +39,27 @@ export default class Box extends React.Component<Props> {
className={buildClassName(css.box, this.props.className, [css.outline, this.props.outline])} className={buildClassName(css.box, this.props.className, [css.outline, this.props.outline])}
> >
{(this.props.headerButtons || this.props.title || this.props.titleColSize || this.props.subtitle || this.props.delimiter || this.props.titleClassName) && ( {(this.props.headerButtons || this.props.title || this.props.titleColSize || this.props.subtitle || this.props.delimiter || this.props.titleClassName) && (
<BoxHeader <div className={buildClassName(
title={this.props.title} css.header
titleColSize={this.props.titleColSize} )}>
subtitle={this.props.subtitle} <Row nomargin justify="space-between">
titleClassName={this.props.titleClassName} <Col>
> {this.props.title && (
{this.props.headerButtons} <Text className={buildClassName(css.title, this.props.titleClassName)}>{this.props.title}</Text>
</BoxHeader> )}
{this.props.subtitle && (
<Text className={css.subtitle}>{this.props.subtitle}</Text>
)}
</Col>
{this.props.children && (
<Col nogrow>
<Row justify="flex-end">
{this.props.headerButtons}
</Row>
</Col>
)}
</Row>
</div>
)} )}
{this.props.children && ( {this.props.children && (
<div className={buildClassName([css.body, !this.props.noPadding])}> <div className={buildClassName([css.body, !this.props.noPadding])}>

View File

@ -13,6 +13,9 @@
li li
display inline-block display inline-block
&.socials a
padding 0 8px
.animation .animation
animation grow 1s linear infinite animation grow 1s linear infinite
display inline-block display inline-block

View File

@ -1,5 +1,6 @@
import { Meta, Story } from '@storybook/react/types-6-0' import { Meta, Story } from '@storybook/react/types-6-0'
import React from 'react' import React from 'react'
import { Zap } from 'react-feather'
import Component from '.' import Component from '.'
export default { export default {
@ -10,6 +11,9 @@ export default {
export const Basic: Story<any> = (args: any) => <Component {...args} /> export const Basic: Story<any> = (args: any) => <Component {...args} />
let tmp = Basic.bind({}) let tmp = Basic.bind({})
tmp.args = {links: [{name: 'test1', path: '/'}, {name: 'test2', path: '/'}, {name: 'test3', path: '/'}]} tmp.args = {
links: [{name: 'test1', path: '/'}, {name: 'test2', path: '/'}, {name: 'test3', path: '/'}],
socials: [{icon: Zap, href: '/'}, {icon: '/16-16.svg', href: '/'}, {icon: Zap, href: '/'}]
}
export const Normal = tmp export const Normal = tmp

View File

@ -1,9 +1,10 @@
import React from 'react' import React, { FC } from 'react'
import { Heart } from 'react-feather' import { Heart } from 'react-feather'
import Link from '../Link' import Link from '../Link'
import { Icon } from 'react-feather'
import Text from '../Text' import Text from '../Text'
import css from './Footer.module.styl' import css from './Footer.module.styl'
import Image from 'next/image'
interface Props { interface Props {
text?: string text?: string
@ -12,6 +13,10 @@ interface Props {
path: string path: string
name: string name: string
}> }>
socials?: Array<{
href: string
icon: Icon | string
}>
} }
export default class Footer extends React.Component<Props> { export default class Footer extends React.Component<Props> {
@ -27,6 +32,17 @@ export default class Footer extends React.Component<Props> {
<li key={l.path}><Text>{index !== 0 && (<>&nbsp;- </>)}<Link href={l.path}>{l.name}</Link></Text></li> <li key={l.path}><Text>{index !== 0 && (<>&nbsp;- </>)}<Link href={l.path}>{l.name}</Link></Text></li>
))}</ul> ))}</ul>
)} )}
{this.props.socials && (
<ul className={css.socials}>{this.props.socials.map((l, index) => (
<li key={l.href}><Text><Link hideIcon noStyle href={l.href}>
{typeof l.icon === 'string' ? (
<Image width={24} height={24} src={l.icon} />
) : (
<l.icon size={24} />
)}
</Link></Text></li>
))}</ul>
)}
</footer> </footer>
) )
} }

View File

@ -180,7 +180,7 @@
~ svg ~ svg
color @border-color color @border-color
&:invalid &:invalid
border-color $errorLight border-color $errorDark
~ label ~ label
color @border-color color @border-color
@ -188,7 +188,7 @@
~ svg ~ svg
color @border-color color @border-color
@media (prefers-color-scheme dark) @media (prefers-color-scheme dark)
border-color $errorDark border-color $errorLight
~ label ~ label
color @border-color color @border-color
@ -229,7 +229,7 @@
background #1c1c1c background #1c1c1c
&:focus &:focus
background rgba(gray, .3) background rgba(gray, .3)
border-bottom 2px solid $default border-bottom 2px solid $main
&.opaque &.opaque
background white background white

View File

@ -7,7 +7,9 @@ export default {
component: Component, component: Component,
argTypes: { argTypes: {
href: {control: 'text', defaultValue: 'https://www.dzeio.com'}, href: {control: 'text', defaultValue: 'https://www.dzeio.com'},
text: {control: 'text', defaultValue: 'Dzeio'} text: {control: 'text', defaultValue: 'Dzeio'},
external: {control: 'boolean'},
hideIcon: {control: 'boolean'}
} }
} as Meta } as Meta

View File

@ -19,23 +19,35 @@ interface Props {
* Override external detection system * Override external detection system
*/ */
external?: boolean external?: boolean
/**
* force hiding the icon
*/
hideIcon?: boolean
} }
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('http') const isExternal = this.props.href.startsWith('http')
if (external) { const externalProps = this.props.external ? {
rel: 'noreferrer nofollow',
target: '_blank'
} : {}
if (isExternal) {
// external link // external link
return ( return (
<a <a
{...this.props.linkProps} {...this.props.linkProps}
className={buildClassName(this.props.className, [css.link, !this.props.noStyle])} className={buildClassName(this.props.className, [css.link, !this.props.noStyle])}
href={this.props.href} href={this.props.href}
rel="noreferrer nofollow" {...externalProps}
target="_blank"
> >
{this.props.children}<ExternalLink size={16} className={css.icon} /> {this.props.children}
{(this.props.external !== false && !this.props.hideIcon) && (
<ExternalLink size={16} className={css.icon} />
)}
</a> </a>
) )
} }
@ -43,6 +55,7 @@ export default class Link extends React.Component<Props> {
<NextLink href={this.props.href}> <NextLink href={this.props.href}>
<a <a
{...this.props.linkProps} {...this.props.linkProps}
{...externalProps}
className={buildClassName(this.props.className, [css.link, !this.props.noStyle])} className={buildClassName(this.props.className, [css.link, !this.props.noStyle])}
>{this.props.children}</a> >{this.props.children}</a>
</NextLink> </NextLink>

View File

@ -5,6 +5,7 @@
bottom 0 bottom 0
left 0 left 0
padding 0 16px padding 0 16px
z-index 400
max-width 25% max-width 25%
@media (max-width $tablet) @media (max-width $tablet)
max-width 50% max-width 50%

View File

@ -3,14 +3,13 @@ import { X } from 'react-feather'
import Text from '../Text' import Text from '../Text'
import Box from '../Box' import Box from '../Box'
import Row from '../Row' import Row from '../Row'
import { Props as HeaderProps } from '../Box/BoxHeader'
import css from './Popup.module.styl' import css from './Popup.module.styl'
interface Props { interface Props {
children: React.ReactNode children: React.ReactNode
onClose?: () => void onClose?: () => void
header?: HeaderProps header?: Box['props']
} }
export default class Popup extends React.Component<Props> { export default class Popup extends React.Component<Props> {

View File

@ -1,11 +1,17 @@
@import '../config'
.table .table
border-spacing 0 border-spacing 0
border 2px solid #EEE border 2px solid $grayDark
@media (prefers-color-scheme dark)
border-color $grayLight
border-radius 4px border-radius 4px
width 100% width 100%
td td
border-top 1px solid #EEE border-top 1px solid $grayDark
@media (prefers-color-scheme dark)
border-color $grayLight
th th
td td

View File

@ -1,6 +1,9 @@
.text .text
margin 0 margin 0
+ .text
margin-top 8px
.white .white
color white color white

View File

@ -0,0 +1,15 @@
import { Meta } from '@storybook/react/types-6-0'
import React from 'react'
import Component from '.'
export default {
title: 'DZEIO/Text',
component: Component
} as Meta
export const Basic = (args: any) => (
<>
<Component {...args}>TExt</Component>
<Component {...args}>TExt</Component>
</>
)