diff --git a/webapp/src/components/UpdateSocialLinks.tsx b/webapp/src/components/UpdateSocialLinks.tsx index 41890cae..642937f1 100644 --- a/webapp/src/components/UpdateSocialLinks.tsx +++ b/webapp/src/components/UpdateSocialLinks.tsx @@ -6,23 +6,48 @@ import { Select, SelectChangeEvent, TextField, + IconButton, } from '@mui/material'; import LinkedInIcon from '@mui/icons-material/LinkedIn'; import LanguageIcon from '@mui/icons-material/Language'; import TwitterIcon from '@mui/icons-material/Twitter'; +import ClearIcon from '@mui/icons-material/Clear'; interface SocialLinksProps { socialName: string; networkData: string; + setSocialNetworkList: React.Dispatch< + React.SetStateAction< + { + id: number; + network_name: string; + protocol: string; + base_url: string; + data: string; + }[] + > + >; + networkId: number; } -const UpdateSocialLinks = ({ socialName, networkData }: SocialLinksProps) => { +const UpdateSocialLinks = ({ + socialName, + networkData, + setSocialNetworkList, + networkId, +}: SocialLinksProps) => { const [socialNetworks, setSocialNetworks] = useState(socialName); const handleChange = (event: SelectChangeEvent) => { setSocialNetworks(event.target.value); }; + function removeItem() { + setSocialNetworkList(prevState => + prevState.filter(network => network.id !== networkId) + ); + } + return ( { value={networkData} variant="standard" /> + + + ); };