Reputation: 95
I've got this really annoying CSS issue. So im rendering these tags as spans like in the picture below but I cant get them to seperate top and bottom, theyre stuck togetehr and I dont know why. Im using styled components to .map them out and render them as individual spans
<TableBody >
{props.filteredData(props.API_DATA,props.filters).map((row,index) => (
<>
<TableRow key={row.name}>
<TableCell style={{ textAlign:"left", width:'5%'}} align="center">{index + 1}</TableCell>
<TableCell style={{ textAlign:"left", width:'25%'}} align="center">{row.bnd}</TableCell>
<TableCell style={{ textAlign:"left", width:'5%'}} align="center">{row.cnt}</TableCell>
<TableCell style={{ textAlign:"left", width:'20%'}} align="center">{row.prt.map((e) => <span key={e}><span style={{backgroundColor:"#FFD9B6", padding:"1px",display:"flex",width:"80px", border:"0.5px solid orange", borderRadius:"3px"}}>{e}</span></span>)}</TableCell>
<TableCell style={{ textAlign:"left", width:'25%'}} align="center"><a href={row.url}>{row.url}</a></TableCell>
</TableRow>
<Waypoint onEnter={()=>limitHandler(index + 10)}/>
</>
))}
</TableBody>
Upvotes: 1
Views: 180
Reputation: 91
If I understand your problem well, you just have to add margins. Is that correct?
<TableBody >
{props.filteredData(props.API_DATA,props.filters).map((row,index) => (
<>
<TableRow key={row.name}>
<TableCell style={{ textAlign:"left", width:'5%'}} align="center">{index + 1}</TableCell>
<TableCell style={{ textAlign:"left", width:'25%'}} align="center">{row.bnd}</TableCell>
<TableCell style={{ textAlign:"left", width:'5%'}} align="center">{row.cnt}</TableCell>
<TableCell style={{ textAlign:"left", width:'20%'}} align="center">{row.prt.map((e) => <span key={e}><span style={{backgroundColor:"#FFD9B6", padding:"1px",display:"flex",width:"80px", border:"0.5px solid orange", borderRadius:"3px"; margin: "5px"}}>{e}</span></span>)}</TableCell>
<TableCell style={{ textAlign:"left", width:'25%'}} align="center"><a href={row.url}>{row.url}</a></TableCell>
</TableRow>
<Waypoint onEnter={()=>limitHandler(index + 10)}/>
</>
))}
</TableBody>
Tested on codepen inside of a table. Check out there - imgur.com
Upvotes: 1