act-now-coalition / act-now-packages

NPM Packages for Act Now Coalition
https://act-now-packages.web.app/
MIT License
4 stars 1 forks source link

ShareButton is not theme-able enough #583

Closed pnavarrc closed 1 year ago

pnavarrc commented 1 year ago

When we first implemented the ShareButton, we wanted to limit how customizable it is, but we found a case where we would like to customize the color of a specific instance, so maybe it would be worth allowing to customize the button color in the same way as the MUI Button and Typography component do

https://demo-world-happiness-report-git-pablo-341709-act-now-coalition.vercel.app/country/canada

// will be white
<Typography variant="h1" color="white">Title</Typography>

// not a valid prop
<ShareButton {...props} color="white" />

an alternative would be to wrap the "above the fold" section with a theme that modifies the buttons using the theme system, which is cleaner and more flexible, but also more work for the user trying to customize a particular section.

<ThemeProvider theme={aboveTheFoldTheme}>
  <Typography variant="h1">Title</Typography>
  <ShareButton {...props} />
</ThemeProvider>

Another example of where theme wrapping might be a good idea is the footer, since we would need to change buttons, links and typography colors (if using a dark background).

Image