I have a styled component I need to reuse. It looks like this:
export const FormFooter = styled.div( ({ theme }) => ` padding: ${theme.spacing(3)}px; border-top: 1px solid ${theme.palette.lighterGray}; position: sticky; width: 100%; `, ) This component is used elsewhere in our codebase and but there's one application where I need it to behave slightly differently. Specifically, I need position to be absolute and bottom to be '0'.
I want to be able to pass additional arguments to this component and set default values for them. Is there a way to do that?
I'm looking for something like:
export const FormFooter = styled.div<{position?: string, bottom?: string}>( ({ theme }) => ` padding: ${theme.spacing(3)}px; border-top: 1px solid ${theme.palette.lighterGray}; position: ${position ? position : 'sticky'}; bottom: ${bottom ? bottom : 'inherit'} width: 100%; `, ) But this gives me a typescript error stating that position and bottom are not defined.