I have implemented react-table to display data in a table format. However, I am facing an issue with the styling of a specific column. I need to change the maxWidth property to 60 for screen sizes xs to xl and to 30 for xxl screens. Is there a way to achieve this inline within the headerProps and cellProps style objects? I prefer not to create a separate file and link the component to it as I'm not very familiar with scss, which is being used in this project.
Below is the code snippet showcasing the accessor containing the cellProps and headerProps:
const columns = [
{
accessor: 'firstName',
Header: 'First Name',
Cell: firstNameFormatter
},
{
accessor: 'lastName',
Header: 'Last Name',
Cell: lastNameFormatter
},
{
accessor: 'actions',
Header: <FontAwesomeIcon icon="cog" className="fs-1 ml-2" />,
headerProps: {
className: 'bg-light',
style: {
maxWidth: 60 // Adjust this value to 30 only for xxl screens
}
},
Cell: actionFormatter,
sticky: 'right',
cellProps: {
className: 'bg-light',
style: {
maxWidth: 60 // Adjust this value to 30 only for xxl screens
}
},
}
];