Add fork-awesome-stack.tsx and extract types

Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
Tilman Vatteroth 2020-08-23 15:03:42 +02:00 committed by mrdrogdrog
parent dfdc652503
commit 058b6ab97a
14 changed files with 50 additions and 18 deletions

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,23 @@
import React, { ReactElement } from 'react'
import { ForkAwesomeIcon, ForkAwesomeIconProps } from './fork-awesome-icon'
import { IconSize } from './types'
export interface ForkAwesomeStackProps {
size?: IconSize
children: ReactElement<ForkAwesomeIconProps> | Array<ReactElement<ForkAwesomeIconProps>>
}
export const ForkAwesomeStack: React.FC<ForkAwesomeStackProps> = ({ size, children }) => {
return (
<span className={`fa-stack ${size ? 'fa-' : ''}${size ?? ''}`}>
{
React.Children.map(children, (child) => {
if (!React.isValidElement<ForkAwesomeIconProps>(child)) {
return null
}
return <ForkAwesomeIcon {...child.props} stacked={true}/>
})
}
</span>
)
}

File diff suppressed because one or more lines are too long

View file

@ -1,7 +1,8 @@
import React from 'react' import React from 'react'
import { Button, ButtonProps } from 'react-bootstrap' import { Button, ButtonProps } from 'react-bootstrap'
import { ForkAwesomeIcon, IconName } from '../fork-awesome/fork-awesome-icon' import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import './icon-button.scss' import './icon-button.scss'
import { IconName } from '../fork-awesome/types'
export interface IconButtonProps extends ButtonProps { export interface IconButtonProps extends ButtonProps {
icon: IconName icon: IconName

View file

@ -1,5 +1,6 @@
import React from 'react' import React from 'react'
import { ForkAwesomeIcon, IconName } from '../fork-awesome/fork-awesome-icon' import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import { IconName } from '../fork-awesome/types'
import { ShowIf } from '../show-if/show-if' import { ShowIf } from '../show-if/show-if'
import { LinkWithTextProps } from './types' import { LinkWithTextProps } from './types'

View file

@ -1,6 +1,7 @@
import React from 'react' import React from 'react'
import { Link } from 'react-router-dom' import { Link } from 'react-router-dom'
import { ForkAwesomeIcon, IconName } from '../fork-awesome/fork-awesome-icon' import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import { IconName } from '../fork-awesome/types'
import { ShowIf } from '../show-if/show-if' import { ShowIf } from '../show-if/show-if'
import { LinkWithTextProps } from './types' import { LinkWithTextProps } from './types'

View file

@ -1,7 +1,8 @@
import React from 'react' import React from 'react'
import { Modal } from 'react-bootstrap' import { Modal } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next' import { Trans, useTranslation } from 'react-i18next'
import { ForkAwesomeIcon, IconName } from '../fork-awesome/fork-awesome-icon' import { ForkAwesomeIcon } from '../fork-awesome/fork-awesome-icon'
import { IconName } from '../fork-awesome/types'
import { ShowIf } from '../show-if/show-if' import { ShowIf } from '../show-if/show-if'
export interface CommonModalProps { export interface CommonModalProps {

View file

@ -1,5 +1,6 @@
import React from 'react' import React from 'react'
import { ForkAwesomeIcon, IconName } from '../../../common/fork-awesome/fork-awesome-icon' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
import { IconName } from '../../../common/fork-awesome/types'
export interface DocumentInfoLineProps { export interface DocumentInfoLineProps {
icon: IconName icon: IconName

View file

@ -1,7 +1,7 @@
import { Moment } from 'moment' import { Moment } from 'moment'
import React from 'react' import React from 'react'
import { Trans, useTranslation } from 'react-i18next' import { Trans, useTranslation } from 'react-i18next'
import { IconName } from '../../../common/fork-awesome/fork-awesome-icon' import { IconName } from '../../../common/fork-awesome/types'
import { DocumentInfoLine } from './document-info-line' import { DocumentInfoLine } from './document-info-line'
import './document-info-time-line.scss' import './document-info-time-line.scss'
import { TimeFromNow } from './time-from-now' import { TimeFromNow } from './time-from-now'

View file

@ -1,7 +1,8 @@
import React, { Fragment, useState } from 'react' import React, { Fragment, useState } from 'react'
import { Dropdown } from 'react-bootstrap' import { Dropdown } from 'react-bootstrap'
import { Trans, useTranslation } from 'react-i18next' import { Trans, useTranslation } from 'react-i18next'
import { ForkAwesomeIcon, IconName } from '../../common/fork-awesome/fork-awesome-icon' import { ForkAwesomeIcon } from '../../common/fork-awesome/fork-awesome-icon'
import { IconName } from '../../common/fork-awesome/types'
import { DeletionModal } from '../../common/modals/deletion-modal' import { DeletionModal } from '../../common/modals/deletion-modal'
export interface DropdownItemWithDeletionModalProps { export interface DropdownItemWithDeletionModalProps {

View file

@ -1,6 +1,6 @@
import React from 'react' import React from 'react'
import { ButtonProps } from 'react-bootstrap' import { ButtonProps } from 'react-bootstrap'
import { IconName } from '../../common/fork-awesome/fork-awesome-icon' import { IconName } from '../../common/fork-awesome/types'
import { IconButton } from '../../common/icon-button/icon-button' import { IconButton } from '../../common/icon-button/icon-button'
export enum SortModeEnum { export enum SortModeEnum {

View file

@ -1,6 +1,7 @@
import React from 'react' import React from 'react'
import { ForkAwesomeIcon, IconName } from '../../../common/fork-awesome/fork-awesome-icon' import { ForkAwesomeIcon } from '../../../common/fork-awesome/fork-awesome-icon'
import './social-link-button.scss' import './social-link-button.scss'
import { IconName } from '../../../common/fork-awesome/types'
export interface SocialButtonProps { export interface SocialButtonProps {
backgroundClass: string, backgroundClass: string,

View file

@ -1,7 +1,7 @@
import React from 'react' import React from 'react'
import { useSelector } from 'react-redux' import { useSelector } from 'react-redux'
import { ApplicationState } from '../../../redux' import { ApplicationState } from '../../../redux'
import { IconName } from '../../common/fork-awesome/fork-awesome-icon' import { IconName } from '../../common/fork-awesome/types'
import { SocialLinkButton } from './social-link-button/social-link-button' import { SocialLinkButton } from './social-link-button/social-link-button'
export enum OneClickType { export enum OneClickType {

View file

@ -1,6 +1,6 @@
import React, { useEffect, useState } from 'react' import React, { useEffect, useState } from 'react'
import { Trans } from 'react-i18next' import { Trans } from 'react-i18next'
import { IconName } from '../../../common/fork-awesome/fork-awesome-icon' import { IconName } from '../../../common/fork-awesome/types'
import { ShowIf } from '../../../common/show-if/show-if' import { ShowIf } from '../../../common/show-if/show-if'
import './one-click-embedding.scss' import './one-click-embedding.scss'