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",
"version": "0.8.5",
"version": "0.9.2",
"license": "MIT",
"main": "./index.js",
"types": "./types/index.d.ts",

View File

@ -12,6 +12,22 @@
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
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 BoxHeader from './BoxHeader'
import { buildClassName } from '../Util'
import css from './Box.module.styl'
import Row from '../Row'
import Col from '../Col'
import Text from '../Text'
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])}
>
{(this.props.headerButtons || this.props.title || this.props.titleColSize || this.props.subtitle || this.props.delimiter || this.props.titleClassName) && (
<BoxHeader
title={this.props.title}
titleColSize={this.props.titleColSize}
subtitle={this.props.subtitle}
titleClassName={this.props.titleClassName}
>
{this.props.headerButtons}
</BoxHeader>
<div 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.headerButtons}
</Row>
</Col>
)}
</Row>
</div>
)}
{this.props.children && (
<div className={buildClassName([css.body, !this.props.noPadding])}>

View File

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

View File

@ -1,5 +1,6 @@
import { Meta, Story } from '@storybook/react/types-6-0'
import React from 'react'
import { Zap } from 'react-feather'
import Component from '.'
export default {
@ -10,6 +11,9 @@ export default {
export const Basic: Story<any> = (args: any) => <Component {...args} />
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

View File

@ -1,9 +1,10 @@
import React from 'react'
import React, { FC } from 'react'
import { Heart } from 'react-feather'
import Link from '../Link'
import { Icon } from 'react-feather'
import Text from '../Text'
import css from './Footer.module.styl'
import Image from 'next/image'
interface Props {
text?: string
@ -12,6 +13,10 @@ interface Props {
path: string
name: string
}>
socials?: Array<{
href: string
icon: Icon | string
}>
}
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>
))}</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>
)
}

View File

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

View File

@ -7,7 +7,9 @@ export default {
component: Component,
argTypes: {
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

View File

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

View File

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

View File

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

View File

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

View File

@ -1,6 +1,9 @@
.text
margin 0
+ .text
margin-top 8px
.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>
</>
)