Innovate with React

Rate this content
Bookmark
Slides
The video covers adding the UseMediaQuery hook in React to make components responsive based on screen size, such as mobile, tablet, or desktop. It explains setting up a React environment, installing Storybook for documentation, and organizing components into separate folders with default exports and absolute paths. The video also demonstrates making components accessible using the Storybook accessibility add-on, customizing Material UI components, and implementing a centralized theme for consistent branding. It highlights the use of the SX prop in Material UI for inline styling and configuring breakpoints for responsive design. The integration of Storybook with Figma through Anima is discussed, allowing designers to sync components for high-fidelity prototyping.

From Author:

In this workshop, you will learn how to create a Custom Component System from scratch in React, and take it to the next level.

You will learn best practices when building a Component System, as well as the tools that you can use to be a more effective collaborator with other cross-functional teams.


What's included

1. Introduction

2. Learn the fundamentals of a Component System

3. Setting up the development environment

4. Importing fonts

5. Choosing a base React Component Library

6. Writing our first components

7. Setting up a centralized theme

8. Writing custom styles to inject to our components

9. Injecting icons to our components

10. Adding hooks

11. Making components responsive

12. Adding dark mode

13. Deploying your Component System

14. Exporting your Component System to a design tool

15. Prototyping with your production components

This workshop has been presented at React Day Berlin 2022, check out the latest edition of this React Conference.

FAQ

Anima is a prototyping tool that allows designers to convert design assets into code. It facilitates the creation of prototypes that resemble the final product by enabling the embedding of functional components directly from development environments like Storybook into design tools like Figma.

The integration allows for direct synchronization of component libraries from Storybook to Figma. This enables designers to use actual production components for high-fidelity prototyping, ensuring consistency between the designed prototype and the final product, and accelerating the design-to-development workflow.

The 'dark mode' feature in Storybook allows users to switch between light and dark visual themes for UI components. It is implemented by defining separate themes for 'light' and 'dark' modes in the Storybook configuration, which can be toggled by a user interface control within Storybook.

To deploy a Storybook instance to the web, you can build a static version of your Storybook using the build command and then deploy this static site to a hosting service like Netlify. This process involves generating a static output directory and then dragging and dropping this directory into Netlify's deployment interface.

Using responsive font sizes in Storybook helps ensure that typography adjusts appropriately across different screen sizes, enhancing the readability and accessibility of UI components on various devices. It's implemented using the 'responsive font sizes' utility which automatically adjusts font sizes based on the screen width.

Cristobal Chao
Cristobal Chao
156 min
29 Nov, 2022

Comments

Sign in or register to post your comment.

Video Transcription

Available in Español: Innovar con React

1. Introduction and Table of Contents

Short description:

Hello, everyone. My name is Cristobal Chao. I live in New York City, but you can probably notice an accent. I am from Spain originally. I came to the States 10 years ago. I live in San Francisco and now I live in New York, so closer and closer to Europe little by little. Let's just start. So here, probably you are already you have in front of you. The, the Table of Contents what I'm sharing with you right now. So what we can do is we have two types of navigation at this level.

Hello, everyone. My name is Cristobal Chao. I live in New York City, but you can probably notice an accent. I am from Spain originally. I came to the States 10 years ago. I live in San Francisco and now I live in New York, so closer and closer to Europe little by little.

Let's just start. So here, probably you are already you have in front of you. The, the Table of Contents what I'm sharing with you right now. So what we can do is we have two types of navigation at this level. One is you can click on any of these sections and then it will get you there, or you can click here on the top right corner in next to go to the next session. All right. We will be covering the introduction, just a little bit of intro. Then we will be doing the setting up the Dev environment, and we will have three sections of implementations where we will cover the very basics of implementing a design system in React. And then we will be adding more and more complexity to it. All right, at the very end, on level up, that's the part that we will be covering at the very, very end. But in any case is, the, I think is the most exciting part. Anyways, let's jump straight in. I know that there is a comment. All right, let me double check. Yep. And all right, it's time to go, guys.

2. Introduction and Environment Setup

Short description:

Introduction: A component system is a single source of truth that communicates the values, tone of voice, and guidelines of an application. It ensures consistency and cohesiveness, benefiting both users and developers. Next, we will set up the environment by installing the necessary packages and creating a new React app. I will guide you through the process, but please note that I may not be able to address all questions. After installing the app, we will open our IDE, clean up unnecessary files and dependencies, and ensure that the React app is still running.

So the introduction. Well, before I jump into this as well. If you guys get stuck at any given point, every single section except the introduction has the downloaded file at the very end. So imagine that you are on, not in this section, on the next one, on setting up the environment, and you get stuck somewhere here. You can always get the latest from this section at the very end. You have the link down here. All right. I know that you may get stuck. So you can always get back on track, all right.

Anyways, so introduction, guys. So what is a component system? So a lot of people have different opinions about what a component system is. But at the end of the day, it is a single source of truth, right? You have all the elements that are used across your application that pretty much communicates the values of your application, the tone of voice, the guidelines, right, the patterns. And it's not a finished product, right? Like we think sometimes that a component system is just the final product, but no, it's not. It's at the end of the day what the product is going to look like so things are more consistent, all right. Do you want to have a component system if you want to see if you want to get an app that is consistent and cohesive? So I think if you have a small company, you probably are not thinking about this. But at the end of the day, this will hurt you. And it will hurt you two ways. One way is from a user level, people will get confused like, where am I? And from a developer perspective, you are not efficiently getting the most out of it, because once you have a component system, you can reuse stuff. And people know what is the latest and greatest. So it's a greatest source of communication.

All right. We're going to jump into setting up the environment. Now, I have to say. I will be doing this with you. So we will be installing everything from scratch. I'm going to have this side by side by side. And if you guys again, if you guys have any questions, let me know. But I'm not going to be able to address all of them. All right. So I have my terminal on the right side. I have on the left side where you should be as well. And we will be installing the packages first. You can go one by one if you don't have NPX or if you don't have yarn. I will be using yarn. All right. But if you have it, if you have if you use NPM is fine. Just understand that any time that you see a command in yarn, you will need to translate that into NPM. All right. I think it's pretty straightforward. But in any case, we're going to do a create a new React app. I expect that all of you know what this is. There are links to the docs here, but I also have the snippet right there. Just copy this and paste it. If you don't have NPM, you need to install it on this first command right here. All right. I'm going to zoom this a little bit. Just in case if you don't see it well. Another thing while I'm installing this, I will be doing this in Visual Code. I think you can use any ID you want, but you may run into some issues with some of this stuff that I will be explaining. But we will cover that in a second. But the thing is, if you have Visual Studio, great. If you don't, best of luck. All right. I hope you will be able to get anywhere. But just in case, I'm just telling you this. We are installing a new React app from the very beginning. I'm doing this with yarn. If you have Visual Studio, you're going to start starting that now because we will get there in a second. All right. I don't see any questions. I hope you guys are not shy. All right. Cool. So we install our React app, and now we can just go to the next level, which is going to our new folder, and start in the server. I do yarn start. Again, if you're using npm, it will be npm run start. All right. We're getting new people coming. All right. Cool. So I just ran the app. I see it here. You probably are familiar with this. You have seen that before, I expect. Anyways, I'm going to come back to our presentation, our workshop, and the first thing we're going to do is we're going to open our IDE. In this case, I will be using Visual Studio, as I mentioned. And we're going to do some cleaning. All right? There are some files that we don't need. One of them is report vitals, and the other one are tests. All right? Tests are very important, guys. Don't get me wrong, but for this presentation, for this workshop, we don't need them. So I'm going to be removing those so things are a little bit cleaner, all right? So I'm going to be removing these files. Report web vitals, setup tests. All gone. If I go now to index JS, I will need to remove some of these files and some of these instances because we don't want them to be around, all right? On the package JSON, you can also remove some of the stuff that we don't need, like some of these dependencies on the top, we don't need them. But because we already install it, I mean, it's fine. Same with the web vitals, we can just remove that, all right? Cool, I'm going to zoom this a little bit so you can also see that, all right, fantastic. And I'm going to double-check that that React app is still running.