From 07dd430ffae854008d1d8860d445d3c9c941ace8 Mon Sep 17 00:00:00 2001 From: Florian BOUILLON Date: Thu, 18 Mar 2021 14:57:35 +0100 Subject: [PATCH] Removed Tag element + Global Update Signed-off-by: Florian BOUILLON --- src/dzeio/Box/BoxHeader/BoxHeader.module.styl | 12 +- src/dzeio/Box/BoxHeader/index.tsx | 8 +- .../Box/BoxWrapper/BoxWrapper.module.styl | 21 +-- src/dzeio/Box/index.tsx | 1 - src/dzeio/Code/Code.module.styl | 8 + src/dzeio/Code/index.tsx | 2 +- src/dzeio/Footer/Footer.module.styl | 21 ++- src/dzeio/Footer/Footer.stories.tsx | 15 ++ src/dzeio/Footer/index.tsx | 27 +++- src/dzeio/Link/Link.module.styl | 9 ++ src/dzeio/Link/index.tsx | 15 +- src/dzeio/Popup/Popup.module.styl | 24 ++- src/dzeio/Tag/Tag.module.styl | 139 ------------------ src/dzeio/Tag/Tag.stories.tsx | 17 --- src/dzeio/Tag/index.tsx | 42 ------ src/index.ts | 2 - 16 files changed, 107 insertions(+), 256 deletions(-) create mode 100644 src/dzeio/Footer/Footer.stories.tsx delete mode 100644 src/dzeio/Tag/Tag.module.styl delete mode 100644 src/dzeio/Tag/Tag.stories.tsx delete mode 100644 src/dzeio/Tag/index.tsx diff --git a/src/dzeio/Box/BoxHeader/BoxHeader.module.styl b/src/dzeio/Box/BoxHeader/BoxHeader.module.styl index 0e6b74b..eb493d2 100644 --- a/src/dzeio/Box/BoxHeader/BoxHeader.module.styl +++ b/src/dzeio/Box/BoxHeader/BoxHeader.module.styl @@ -3,19 +3,11 @@ .header padding 16px -.delimiter - border-bottom 2px solid grey - padding-bottom 2px - -.img - border-top-left-radius 4px - border-top-right-radius 4px - .title font-weight bold - font-size rem(20) + font-size rem(18) margin 0 0 8px .subtitle - font-size rem(14) + font-size rem(16) margin 0 diff --git a/src/dzeio/Box/BoxHeader/index.tsx b/src/dzeio/Box/BoxHeader/index.tsx index 6727dda..5fffffe 100644 --- a/src/dzeio/Box/BoxHeader/index.tsx +++ b/src/dzeio/Box/BoxHeader/index.tsx @@ -11,21 +11,15 @@ export interface Props { title?: string titleColSize?: number subtitle?: string - delimiter?: boolean titleClassName?: string - // image?: ImageProps } export default class BoxHeader extends React.Component { public render = () => ( <> - {/* {this.props.image && ( - - )} */}
diff --git a/src/dzeio/Box/BoxWrapper/BoxWrapper.module.styl b/src/dzeio/Box/BoxWrapper/BoxWrapper.module.styl index fe8216f..16c6267 100644 --- a/src/dzeio/Box/BoxWrapper/BoxWrapper.module.styl +++ b/src/dzeio/Box/BoxWrapper/BoxWrapper.module.styl @@ -1,21 +1,12 @@ @import "../../config" .box - background white + background $foregroundLight + @media (prefers-color-scheme dark) + background $foregroundDark border-radius 8px - box-shadow 0px 2px 4px 0px rgba(black, .33) - transition all $transition .outline - border 2px solid #E0E0E0 - box-shadow none - transition border-color $transition - - &:hover - border-color darken(@border[2], 20%) - -@media (prefers-color-scheme dark) - .box - background #202020 - .outline - border-color #1F1F1F + border 2px solid $grayDark + @media (prefers-color-scheme dark) + border-color $grayLight diff --git a/src/dzeio/Box/index.tsx b/src/dzeio/Box/index.tsx index 4aff485..67482bd 100644 --- a/src/dzeio/Box/index.tsx +++ b/src/dzeio/Box/index.tsx @@ -32,7 +32,6 @@ export default class Box extends React.Component { title={this.props.title} titleColSize={this.props.titleColSize} subtitle={this.props.subtitle} - delimiter={this.props.delimiter} titleClassName={this.props.titleClassName} > {this.props.headerButtons} diff --git a/src/dzeio/Code/Code.module.styl b/src/dzeio/Code/Code.module.styl index 88103c0..6b014bc 100644 --- a/src/dzeio/Code/Code.module.styl +++ b/src/dzeio/Code/Code.module.styl @@ -3,3 +3,11 @@ background #E8EAF6 padding 4px 8px border-radius 8px + +.pre + border-radius 8px + padding 4px 8px + background #E8EAF6 + display block + .code + padding 0 diff --git a/src/dzeio/Code/index.tsx b/src/dzeio/Code/index.tsx index a4cae6f..598fb98 100644 --- a/src/dzeio/Code/index.tsx +++ b/src/dzeio/Code/index.tsx @@ -19,7 +19,7 @@ export default class Code extends React.Component { } return ( -
+			
 				{code}
 			
) diff --git a/src/dzeio/Footer/Footer.module.styl b/src/dzeio/Footer/Footer.module.styl index 0df2993..362fdf8 100644 --- a/src/dzeio/Footer/Footer.module.styl +++ b/src/dzeio/Footer/Footer.module.styl @@ -2,22 +2,27 @@ .footer padding 24px 16px + background $foregroundLight + @media (prefers-color-scheme dark) + background $foregroundDark + + ul + list-type none + li + display inline-block .animation animation grow 1s linear infinite display inline-block + vertical-align middle + margin 0 2px @keyframes grow 0% - transform scale(1) - 40% - transform scale(1) - 50% - transform scale(1.2) 60% - transform scale(1) - 70% - transform scale(1.2) 95% transform scale(1) + 50% + 70% + transform scale(1.2) diff --git a/src/dzeio/Footer/Footer.stories.tsx b/src/dzeio/Footer/Footer.stories.tsx new file mode 100644 index 0000000..70397ad --- /dev/null +++ b/src/dzeio/Footer/Footer.stories.tsx @@ -0,0 +1,15 @@ +import { Meta, Story } from '@storybook/react/types-6-0' +import React from 'react' +import Component from '.' + +export default { + title: 'DZEIO/Footer', + component: Component, +} as Meta + +export const Basic: Story = (args: any) => + +let tmp = Basic.bind({}) +tmp.args = {links: [{name: 'test1', path: '/'}, {name: 'test2', path: '/'}, {name: 'test3', path: '/'}]} + +export const Normal = tmp diff --git a/src/dzeio/Footer/index.tsx b/src/dzeio/Footer/index.tsx index c66aa8a..e647dd9 100644 --- a/src/dzeio/Footer/index.tsx +++ b/src/dzeio/Footer/index.tsx @@ -1,13 +1,32 @@ import React from 'react' +import { Heart } from 'react-feather' +import Link from '../Link' import Text from '../Text' import css from './Footer.module.styl' -export default class Footer extends React.Component { +interface Props { + text?: string + company?: string + links?: Array<{ + path: string + name: string + }> +} + +export default class Footer extends React.Component { public render = () => (
- Made with 💗 by Dzeio - Copyright © 2020 Dzeio. All rights reserved. + {this.props.text ? ( + {this.props.text} + ) : ( + Made with by {this.props.company || 'Dzeio'} + )} + {this.props.links && ( +
    {this.props.links.map((l, index) => ( +
  • {index !== 0 && (<> - )}{l.name}
  • + ))}
+ )}
) -} +} \ No newline at end of file diff --git a/src/dzeio/Link/Link.module.styl b/src/dzeio/Link/Link.module.styl index 8cd08ef..ecab51b 100644 --- a/src/dzeio/Link/Link.module.styl +++ b/src/dzeio/Link/Link.module.styl @@ -1,3 +1,12 @@ +@import '../config' + +.link + color $infoLight + @media (prefers-color-scheme dark) + color $infoDark + &:hover + text-decoration underline + .icon vertical-align sub margin 2px diff --git a/src/dzeio/Link/index.tsx b/src/dzeio/Link/index.tsx index 3995853..8dc210e 100644 --- a/src/dzeio/Link/index.tsx +++ b/src/dzeio/Link/index.tsx @@ -3,22 +3,27 @@ import NextLink from 'next/link' import { ExternalLink } from 'react-feather' import css from './Link.module.styl' +import { buildClassName } from '../Util' interface Props { href: string children?: React.ReactNode className?: string - forceNewTab?: boolean + /** + * Override external detection system + */ + external?: boolean } export default class Link extends React.Component { public render() { - if (!this.props.href.startsWith('/')) { + const external = this.props.external ?? !this.props.href.startsWith('/') + if (external) { // external link return ( { return ( {this.props.children} ) diff --git a/src/dzeio/Popup/Popup.module.styl b/src/dzeio/Popup/Popup.module.styl index 0f97bf8..1fef2c6 100644 --- a/src/dzeio/Popup/Popup.module.styl +++ b/src/dzeio/Popup/Popup.module.styl @@ -6,22 +6,38 @@ width 100% top 0 left 0 - background rgba(black, .3) + background rgba($backgroundLight, .7) + @media (prefers-color-scheme dark) + background rgba($backgroundDark, .7) cursor pointer - z-index 1000 + z-index 200 + animation fadeIn .3s ease-in-out 1 forwards + +@keyframes fadeIn + from + opacity 0 + to + opacity 1 + .popupChild cursor initial - z-index 1001 + z-index 201 min-width 50% + animation popin .3s ease-in-out 1 @media (max-width $tablet) min-width 70% @media (max-width $mobile) min-width 90% - // min-height 50vh + +@keyframes popin + from + margin-top 50px + to + margin-top 0 .exit cursor pointer diff --git a/src/dzeio/Tag/Tag.module.styl b/src/dzeio/Tag/Tag.module.styl deleted file mode 100644 index 2ea4f9e..0000000 --- a/src/dzeio/Tag/Tag.module.styl +++ /dev/null @@ -1,139 +0,0 @@ -@import '../config' - -.tag - padding 8px 12px - border-radius 8px - margin-left 8px - height 32px - line-height 1 - display inline-block - color white - - background $default - outline none - &:hover - background darken($default, 10%) - &:focus - background darken($default, 20%) - - &.outline - border 2px solid $default - padding 6px 10px - background transparent - &:hover - background rgba($default, .5) - &:focus - background rgba($default, .7) - -.primary - $color = $primary - color white - background $color - &:hover - background lighten($color, 30%) - &:focus - background lighten($color, 15%) - - &.outline - color black - border 2px solid $color - background transparent - &:hover - color white - background rgba($color, .5) - &:focus - color white - background rgba($color, .7) -.secondary - $color = $secondary - background $color - &:hover - background lighten($color, 30%) - &:focus - background lighten($color, 15%) - &.outline - color white - border 2px solid $color - background transparent - &:hover - color black - background rgba($color, .5) - &:focus - color black - background rgba($color, .7) - -.info - $color = $info - color white - background $color - &:hover - background lighten($color, 30%) - &:focus - background lighten($color, 15%) - &.outline - color black - border 2px solid $color - background transparent - &:hover - color white - background rgba($color, .5) - &:focus - color white - background rgba($color, .7) - -.success - $color = $success - color white - background $color - &:hover - background lighten($color, 30%) - &:focus - background lighten($color, 15%) - &.outline - color black - border 2px solid $color - background transparent - &:hover - color white - background rgba($color, .5) - &:focus - color white - background rgba($color, .7) - -.danger - $color = $danger - color white - background $color - &:hover - background lighten($color, 30%) - &:focus - background lighten($color, 15%) - &.outline - color black - border 2px solid $color - background transparent - &:hover - color white - background rgba($color, .5) - &:focus - color white - background rgba($color, .7) - -.warning - $color = $warning - color white - background $color - &:hover - background lighten($color, 30%) - &:focus - background lighten($color, 15%) - &.outline - color black - border 2px solid $color - background transparent - &:hover - color white - background rgba($color, .5) - &:focus - color white - background rgba($color, .7) diff --git a/src/dzeio/Tag/Tag.stories.tsx b/src/dzeio/Tag/Tag.stories.tsx deleted file mode 100644 index 34fe6f3..0000000 --- a/src/dzeio/Tag/Tag.stories.tsx +++ /dev/null @@ -1,17 +0,0 @@ -import { Meta } from '@storybook/react/types-6-0' -import React from 'react' -import Component from '.' - -export default { - title: 'DZEIO/Tag', - component: Component -} as Meta - -export const Basic = (args: any) => { - const content = args.content - delete args.content - - return ( - {content} - ) -} diff --git a/src/dzeio/Tag/index.tsx b/src/dzeio/Tag/index.tsx deleted file mode 100644 index b50840f..0000000 --- a/src/dzeio/Tag/index.tsx +++ /dev/null @@ -1,42 +0,0 @@ -import React from 'react' - -import { ColorType } from '../interfaces' -import { buildClassName } from '../Util' -import Link from '../Link' - -import css from './Tag.module.styl' -import Text from '../Text' - -interface Props { - text: string - color?: ColorType - href?: string - outline?: boolean -} - -export default class Tag extends React.Component { - - public render() { - const classes = buildClassName( - css.tag, - [css[this.props.color as string], this.props.color], - [css.outline, this.props.outline] - ) - if (!this.props.href) { - return ( - {this.props.text} - ) - } - return ( - - {this.props.text} - - ) - } - -} diff --git a/src/index.ts b/src/index.ts index 2951ec7..84d7ffa 100644 --- a/src/index.ts +++ b/src/index.ts @@ -19,7 +19,6 @@ import Popup from './dzeio/Popup' import Row from './dzeio/Row' import SidebarContainer from './dzeio/SidebarContainer' import Table from './dzeio/Table' -import Tag from './dzeio/Tag' import Text from './dzeio/Text' import * as Util from './dzeio/Util' @@ -50,7 +49,6 @@ export { Row, SidebarContainer, Table, - Tag, Text, Util } \ No newline at end of file