import React from 'react';
import Container from 'react-bootstrap/Container';

export type Props = {
    title: string,
    icon?: string,
    tags: string[],
    style?: 'primary' | 'light'
}

function Tag(props: {text: string}) {
    return (
        <span className='badge text-bg-light'>{props.text}</span>
    )
}

export default function TagCloud(props: Props) {
    const containerClasses = ['tag-cloud', 'cloud-' + (props.style || 'standard')]
    return (
        <Container className={containerClasses.join(' ')}>
            <h4>{props.icon && (<i className={'bi-' + props.icon}> </i>)}{props.title}</h4>
            <Container className='tag-badges'>
                {props.tags.map((tag: string) => (<Tag key={tag} text={tag} />) )}
            </Container>
        </Container>
    )
}
