mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-06-03 16:38:50 -04:00
Add fork-awesome-stack.tsx and extract types
Signed-off-by: Tilman Vatteroth <tilman.vatteroth@tu-dortmund.de>
This commit is contained in:
parent
dfdc652503
commit
058b6ab97a
14 changed files with 50 additions and 18 deletions
File diff suppressed because one or more lines are too long
23
src/components/common/fork-awesome/fork-awesome-stack.tsx
Normal file
23
src/components/common/fork-awesome/fork-awesome-stack.tsx
Normal 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>
|
||||
)
|
||||
}
|
2
src/components/common/fork-awesome/types.d.ts
vendored
Normal file
2
src/components/common/fork-awesome/types.d.ts
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue