Conversation Starters: Initial commit

This commit is contained in:
vinodkiran
2023-11-17 07:22:08 +05:30
parent a311e024e1
commit 0f464fddb8
3 changed files with 106 additions and 15 deletions
@@ -0,0 +1,49 @@
import Chip from '@mui/material/Chip'
import Box from '@mui/material/Box'
import PropTypes from 'prop-types'
import { MenuItem, Select } from '@mui/material'
const StarterConversationCard = ({ isGrid, chipsData, onChipClick }) => {
if (isGrid) {
const chipStyle = {
margin: '5px',
width: 'calc(50% - 10px)'
}
return (
<Box
sx={{
display: 'flex',
flexDirection: 'row',
flexWrap: 'wrap',
width: '100%'
}}
>
{chipsData.map((chipLabel, index) => (
<Chip key={index} label={chipLabel} style={chipStyle} onClick={() => onChipClick(chipLabel)} />
))}
</Box>
)
} else {
return (
<Select defaultValue='' onChange={(event) => onChipClick(event.target.value)} displayEmpty fullWidth>
<MenuItem value='' disabled>
Select a Chip
</MenuItem>
{chipsData.map((chipLabel, index) => (
<MenuItem key={index} value={chipLabel}>
{chipLabel}
</MenuItem>
))}
</Select>
)
}
}
StarterConversationCard.propTypes = {
isGrid: PropTypes.bool,
chipsData: PropTypes.arrayOf(PropTypes.string),
onChipClick: PropTypes.func
}
export default StarterConversationCard