Skip to content

Conversation

@mamihelj09
Copy link

@mamihelj09 mamihelj09 commented Mar 23, 2021

Chakra

Add chakra to example project based on handbook rules.
Features:

  • custom theme
  • color mode
  • folder structure
  • use custom font
  • load images
  • import svg files

https://infinum.com/handbook/books/frontend/react/css-in-js/chakra
https://infinum.com/handbook/books/frontend/react/project-structure#codecomponentscode-folder

@@ -0,0 +1,16 @@
export const Container = {
sizes: {
s: {
Copy link

Choose a reason for hiding this comment

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

Chakra already has some global size settings for container theme.sizes.container https://chakra-ui.com/docs/layout/container

Copy link
Author

Choose a reason for hiding this comment

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

Yes but I wanted to create an example with custom size just to show how

Copy link

Choose a reason for hiding this comment

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

then at least use chakra size keywords xs, sm, md, lg,... https://chakra-ui.com/docs/theming/theme#sizes

<Global styles={globalStyles} />
<Component {...pageProps} />
<ChakraProvider theme={theme}>
<Fonts />
Copy link

Choose a reason for hiding this comment

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

don't forget to preload fonts in _document

        <Head>
         <link
            rel="preload"
            href="/fonts/Space-Grotesk/SpaceGrotesk-Regular.woff"
            as="font"
            type="font/woff"
            crossOrigin="true"
          />
          </Head>

tsconfig.json Outdated
"jsx": "preserve",
"baseUrl": ".",
"paths": {
"@components/*": ["src/components/*"],
Copy link

Choose a reason for hiding this comment

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

We haven't agreed on the syntax yet, but I would go with @/components/* and skip the shared and utilities

Copy link

Choose a reason for hiding this comment

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

tsconfig.json Outdated
"jsx": "preserve",
"baseUrl": ".",
"paths": {
"@components/*": ["src/components/*"],
Copy link

Choose a reason for hiding this comment

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

@mamihelj09 mamihelj09 requested a review from isBatak March 24, 2021 08:22

export const Fonts = () => (
<Global
styles={`
Copy link
Member

Choose a reason for hiding this comment

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

Tabs/spaces mix?

@mamihelj09 mamihelj09 merged commit 643582f into master Apr 9, 2021
@mamihelj09 mamihelj09 deleted the styling branch April 9, 2021 09:49
kamdubiel added a commit that referenced this pull request Nov 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants