new Fixes

- Box Header should be bold
- Buttons Hover/Active forms not correct
- Fixed one of the old Checkbox bug
- Footer Made with should be bold
- Sidebar fixes

Signed-off-by: Avior <florian.bouillon@delta-wings.net>
This commit is contained in:
Florian Bouillon 2021-12-02 00:07:27 +01:00
parent f71223b1dc
commit 3495142453
Signed by: Florian Bouillon
GPG Key ID: 50BD648F12C86AB6
12 changed files with 15246 additions and 5153 deletions

View File

@ -8,6 +8,7 @@ module.exports = {
core: { core: {
builder: "webpack5" builder: "webpack5"
}, },
staticDirs: ["./public"],
"addons": [ "addons": [
"@storybook/addon-essentials" "@storybook/addon-essentials"
], ],

20264
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -29,12 +29,12 @@
"webpack": "^5.55.1" "webpack": "^5.55.1"
}, },
"peerDependencies": { "peerDependencies": {
"next": "^11.0.0", "next": ">=11.0.0",
"react": "^17.0.0", "react": "^17.0.0",
"react-dom": "^17.0.0" "react-dom": "^17.0.0"
}, },
"scripts": { "scripts": {
"dev": "start-storybook -s ./.storybook/public -p 6006", "dev": "start-storybook -p 6006",
"build": "rollup --config", "build": "rollup --config",
"prepublishOnly": "npm run build", "prepublishOnly": "npm run build",
"postinstall": "rollup --config" "postinstall": "rollup --config"

View File

@ -17,7 +17,7 @@ export default class BoxHeader extends React.Component<Props> {
<div className={css.header}> <div className={css.header}>
<Row justify="space-between"> <Row justify="space-between">
<Col> <Col>
<Text className={css.title}> <Text className={css.title} weight="bold">
{this.props.icon && ( {this.props.icon && (
<span className={css.icon}> <span className={css.icon}>
<this.props.icon strokeWidth="2" fontWeight="800" size="20" color="white" /> <this.props.icon strokeWidth="2" fontWeight="800" size="20" color="white" />

View File

@ -26,26 +26,7 @@
text-decoration none text-decoration none
&.outline &.outline
border 2px solid @background-color
padding 8px 18px // @padding - @border
background transparent
color @background-color
&:not(:disabled)
&:hover
&:active
&:focus
color $textOnMain
&:hover
box-shadow none
&.ghost &.ghost
background transparent
color black
@media (prefers-color-scheme dark)
color white
&:hover &:hover
box-shadow none box-shadow none
background-color rgba($main, .25) background-color rgba($main, .25)
@ -53,6 +34,25 @@
&:active &:active
&:focus &:focus
background-color $main background-color $main
color $textOnMain
&.outline
border 2px solid @background-color
padding 8px 18px // @padding - @border
background transparent
color @background-color
&:not(:disabled)
&:active
&:focus
color $textOnMain
&.ghost
background transparent
color black
@media (prefers-color-scheme dark)
color white
&:hover &:hover
background-color @background-color background-color @background-color

View File

@ -93,7 +93,6 @@ $backColor = #757575
width 24px width 24px
height 14px height 14px
border-radius 20px border-radius 20px
top 50%
margin-right 10px margin-right 10px
box-shadow none box-shadow none
background rgba($darkGrayLight, .3) background rgba($darkGrayLight, .3)

View File

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

View File

@ -31,7 +31,7 @@ export default class Footer extends React.Component<Props> {
{this.props.text ? ( {this.props.text ? (
<Text>{this.props.text}</Text> <Text>{this.props.text}</Text>
) : ( ) : (
<Text>Made with <span className={css.animation}><Heart color={'#E6808A'} fill={'#E6808A'} size={16} fillOpacity={0.5} /></span> by {this.props.company || 'Dzeio'}</Text> <Text weight="bold">Made with <span className={css.animation}><Heart color={'#E6808A'} fill={'#E6808A'} size={16} fillOpacity={0.5} /></span> by {this.props.company || 'Dzeio'}</Text>
)} )}
</Col> </Col>
<Col> <Col>

View File

@ -20,7 +20,7 @@ tmp.args = {label: 'Label', helper: 'Helper', maxLength: 6, iconLeft: {
export const Normal = tmp export const Normal = tmp
tmp = Basic.bind({}) tmp = Basic.bind({})
tmp.args = {label: 'Label', filled:true, helper: 'Helper', choices: [ tmp.args = {label: 'Label', helper: 'Helper', choices: [
'a', 'a',
'a', 'a',
'a', 'a',

View File

@ -42,28 +42,37 @@
cursor pointer cursor pointer
.userSpace .userSpace
> div cursor pointer
div, p
transition all $transition transition all $transition
p p
overflow hidden overflow hidden
white-space nowrap white-space nowrap
svg >div:last-child p
cursor pointer padding 8px 8px 4px
border-radius 8px
&:hover
color black
background $lightGrayLight
@media (prefers-color-scheme dark)
color white
background $darkGrayDark
&:active
color $textOnMain
background $main
&.short &.short
width 88px width 88px
.userSpace > div:first-child .userSpace > div:not(:last-child)
.header > div:first-child .header > div:first-child
width 0 width 0
max-width 0 max-width 0
padding-left 0
.header .header
margin-left -16px margin-left -16px
> div:first-child > div:first-child
padding-left 0 !important padding-left 0 !important
.header > div svg .header > div svg
.userSpace svg
margin 0 8px
.header .imgContainer .header .imgContainer
> ul > ul
span span
@ -161,3 +170,16 @@
list-style none list-style none
margin 0 margin 0
padding 0 padding 0
.userMenu
position absolute
bottom 16px
left 316px
z-index 200
&.short
left 104px
&.fullWidth
left 16px
width calc(100% - 32px)

View File

@ -15,6 +15,7 @@ export const Sidebar: Story<any> = (args: any) => <Component {...args} />
Sidebar.args = { Sidebar.args = {
logo: {src: '/90-38.svg', width: 90, height: 38}, logo: {src: '/90-38.svg', width: 90, height: 38},
user: { user: {
picture: '/16-16.svg',
name: 'Username', name: 'Username',
menu: [{ menu: [{
path: '/logout', path: '/logout',
@ -41,4 +42,5 @@ Sidebar.args = {
name: 'Link', name: 'Link',
icon: ZapOff icon: ZapOff
}], }],
// fullWidth: true
} }

View File

@ -1,12 +1,12 @@
import React, { MouseEvent } from 'react' import React, { MouseEvent } from 'react'
import Router from 'next/router' import Router from 'next/router'
import Image, { ImageProps } from 'next/image'
import { ChevronDown, Minus, MoreHorizontal, Plus } from 'lucide-react' import { ChevronDown, Minus, MoreHorizontal, Plus } from 'lucide-react'
import Text from '../Text' import Text from '../Text'
import Col from '../Col' import Col from '../Col'
import Row from '../Row' import Row from '../Row'
import Link from '../Link' import Link from '../Link'
import Image from '../Image'
import { buildClassName } from '../Util' import { buildClassName } from '../Util'
import css from './Sidebar.module.styl' import css from './Sidebar.module.styl'
@ -17,7 +17,6 @@ interface MenuItem {
path?: string path?: string
icon?: Icon icon?: Icon
name: string name: string
subMenu?: Array<MenuItem>
} }
interface Props { interface Props {
@ -25,11 +24,12 @@ interface Props {
/** /**
* Logo to display * Logo to display
*/ */
logo?: ImageProps & {height: number, width: number} logo?: Image['props']['imageProps'] & {height: number, width: number}
/** /**
* User Informations if loggedin * User Informations if loggedin
*/ */
user?: { user?: {
picture?: string
/** /**
* Username * Username
*/ */
@ -42,7 +42,7 @@ interface Props {
/** /**
* Links to display * Links to display
*/ */
menu: Array<MenuItem> menu: Array<MenuItem & {subMenu?: Array<MenuItem>}>
onClose?: () => boolean onClose?: () => boolean
@ -141,7 +141,7 @@ export default class Navbar extends React.Component<Props, State> {
{this.props.logo && ( {this.props.logo && (
<Col> <Col>
<Link href="/"> <Link href="/">
<Image {...this.props.logo} height={34} width={this.props.logo.width*34/this.props.logo.height} /> <Image imageProps={{ ...this.props.logo, height: 34, width: this.props.logo.width * 34 / this.props.logo.height }} />
</Link> </Link>
</Col> </Col>
)} )}
@ -155,14 +155,17 @@ export default class Navbar extends React.Component<Props, State> {
<div style={{flex: 1}}></div> <div style={{flex: 1}}></div>
{/* Spacer */} {/* Spacer */}
{this.props.user && ( {this.props.user && (
<Row className={css.userSpace}> <Row className={css.userSpace} align="center" onClick={(ev) => {ev.stopPropagation(); this.setState({userMenu: !this.state.userMenu})}}>
{this.props.user.picture && (
<Col nogrow><Image imageProps={{ src: this.props.user.picture, width: 38, height: 38 }} /></Col>
)}
<Col><Text>{this.props.user.name}</Text></Col> <Col><Text>{this.props.user.name}</Text></Col>
<Col nogrow><Text><MoreHorizontal size={24} onClick={(ev) => {ev.stopPropagation(); this.setState({userMenu: !this.state.userMenu})}} /></Text></Col> <Col nogrow><Text><MoreHorizontal size={24} /></Text></Col>
</Row> </Row>
)} )}
</nav> </nav>
{this.props.user?.menu && this.state.userMenu && ( {this.props.user?.menu && this.state.userMenu && (
<div style={{position: 'absolute', bottom: 16, left: this.props.fullWidth ? 16 : this.state.open ? 316 : 104}}> <div className={buildClassName(css.userMenu, [css.fullWidth, this.props.fullWidth], [css.short, !this.state.open])}>
<Menu onClick={this.onMenuClick} outline items={this.props.user.menu.map((v) => ({ <Menu onClick={this.onMenuClick} outline items={this.props.user.menu.map((v) => ({
display: v.name, display: v.name,
value: v.path, value: v.path,
@ -193,7 +196,7 @@ export default class Navbar extends React.Component<Props, State> {
} }
} }
private makeMenuItem(obj: MenuItem, isSub = false) { private makeMenuItem(obj: MenuItem & {subMenu?: Array<MenuItem>}, isSub = false) {
const id = obj.name + obj.path const id = obj.name + obj.path
const content = ( const content = (
<> <>