Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[website] Migrate Product-Templates page to use CSS theme variables #34913

Merged
merged 11 commits into from
Oct 31, 2022
Merged

[website] Migrate Product-Templates page to use CSS theme variables #34913

merged 11 commits into from
Oct 31, 2022

Conversation

EduardoSCosta
Copy link
Contributor

Migrate product-templates page from #34880

@mui-bot
Copy link

mui-bot commented Oct 27, 2022

Messages
📖 Netlify deploy preview: https://deploy-preview-34913--material-ui.netlify.app/

No bundle size changes

Generated by 🚫 dangerJS against e242efe

@EduardoSCosta
Copy link
Contributor Author

EduardoSCosta commented Oct 27, 2022

I'm getting the following error:
Screenshot_20221027_173357

caused by in the IconImage component inside TemplateHero.tsx.

<IconImage name="product-templates" />

It happens after change to BrandingCssVarsProvider.

Another problem, StoreTemplateImage in StoreTemplatesBanner.tsx gives me the following warning:
Warning: Prop `src` did not match. Server: "/static/branding/store-templates/template-light5.jpeg" Client: "/static/branding/store-templates/template-dark5.jpeg"

@siriwatknp
Copy link
Member

siriwatknp commented Oct 28, 2022

IconImage

@EduardoSCosta This PR should fix the problem: #34914.

@siriwatknp
Copy link
Member

For the StoreTemplateBanner.tsx, please try this:

5. img switch between color modes

From StoreTemplatesBanner.tsx.

Example code:

const globalTheme = useTheme();
  const mode = globalTheme.palette.mode;
  return (
    <Image
      ref={ref}
      src={`/static/branding/store-templates/template-${mode}${Object.keys(linkMapping).indexOf(brand) + 1}.jpeg`}
      alt=""
      {...props}
    />
  );

Migrated code: use CSS content: url(...):

<Image
  ref={ref}
  src={`/static/branding/store-templates/template-light${Object.keys(linkMapping).indexOf(brand) + 1}.jpeg`}
  alt=""
  sx={(theme) =>
    theme.applyDarkStyles({
      content: `url(/static/branding/store-templates/template-dark${Object.keys(linkMapping).indexOf(brand) + 1}.jpeg)`,
    })
  }
  {...props}
/>

@siriwatknp siriwatknp added the website Pages that are not documentation-related, marketing-focused. label Oct 28, 2022
@EduardoSCosta EduardoSCosta marked this pull request as ready for review October 28, 2022 14:45
Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 Thanks for your contribution! looks good to me.

@siriwatknp siriwatknp merged commit ab3b6a4 into mui:master Oct 31, 2022
daniel-rabe pushed a commit to daniel-rabe/material-ui that referenced this pull request Nov 29, 2022
feliperli pushed a commit to jesrodri/material-ui that referenced this pull request Dec 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
website Pages that are not documentation-related, marketing-focused.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants