Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Note

This document is a work in progress!!! Attempting to create a comprehensive guide that can be used for orienting developers new to edX or new to frontend development.

This handbook is meant to provide an overview of how we develop frontend features at edX. We’ll guide you through our four main phases of frontend development and provide checklists, tips, and tutorials in areas that you should aim to strengthen your skills in over time.

Table of Contents

Pre-Development 📝

What is pre-development? Pre-development is everything that goes on before you start coding. The things that happen in pre-development are mostly out of your hands, but as an engineer, there are things you should be aware of to make the development process more smooth.

The two main pieces of pre-development are product definition and design. In product definition, your Product Manager will define what is to be built (along with why/when/how). In product design, your Designer will provide a feature mockup through Figma. This is where your awareness as an engineer is important.

Pre-development checklist

When you’re given a mockup by a Designer, consider the items in the following checklist. If anything is missing, you’ll want to ask your Designer for clarity before starting development.

Expand
titlePre-development checklist (open me!!!)
  •  Were you given a Figma mock by a Designer?
  • All designs should come from the Design Team to maintain consistency across our platform.

  • All designs should use Figma in order to take advantage of our design system components and styling classes.

  •  Were you provided a mobile mockup?
  • Is it clear how the design should change based on different screen sizes?

  •  Was the mockup/feature discussed with Jeff Witt, our Accessibility Specialist, for feedback?
  •  Do clickable items have the correct states defined?
  • If a design introduces a new clickable item that is not yet captured in Paragon, you should seek to understand what the design of the component is for the component’s focus state, hover state, active state, etc.

  •  Were you provided the necessary microcopy for accessibility?
  •  Will any part of the design include a Paragon contribution?
  • It is important to clarify which elements of the design already exist in Paragon.

    • If a component exists in Paragon, consider whether it needs to be updated to match the mock.

    • If a component doesn’t exist in Paragon, consider whether it needs to be created and proposed to the Paragon Working Group.

    • We also source all of our icons from Paragon! Make sure to check if your design is using any new icons that will need to be added to Paragon.

  • At this point you may be asking yourself, “What is Paragon?” Great question! We’ll describe what Paragon is, along with how Figma and Paragon work together in the following sections.

Info

If you are an engineer in the Open edX community, you may be your own product manager and/or designer! While it isn’t necessary to use Figma when designing a new feature, consider how what you build fits into the Open edX design system. Additionally, ensure that you are following web accessibility guidelines. edX currently adheres to WCAG 2.2 AA standards.

This list is a starting point to make sure you have what you need to effectively develop your feature. We encourage you to collaborate with a Designer in answering these questions as early in the process as possible. If you can think of more common questions, please add to the checklist above.

What is Paragon?

Paragon is our open-source component library that reflects our design system. Using components (and other styling elements) from Paragon allows us to maintain consistency across our different platforms.

If you’re familiar with Bootstrap, Material UI, Semantic UI, or similar UI frameworks, you’ll get the hang of Paragon in no time! Paragon is comprised of components and styling utility classes that are based on React-Bootstrap (https://react-bootstrap.github.io/ ) under the hood.

Additionally, Paragon is a theme-ready library, so anyone using the library is able to override the default colors and typography with their own theme. We do this at edX to override the Open edX styling with our own branding through https://github.com/edx/brand-edx.org, but we’ll get into the specifics of this in a bit.

Action item: Familiarize yourself with Paragon

Spend some time familiarizing yourself with Paragon’s documentation. Visit both the edX themed Paragon site and the Open edX themed Paragon site and observe the differences in colors and typography. Click through the components and visit the different https://paragon-edx.netlify.app/foundations/layout, https://paragon-edx.netlify.app/foundations/spacing/, https://paragon-edx.netlify.app/foundations/icons/, and https://paragon-edx.netlify.app/foundations/css-utilities sections to understand what you have to work with.

How do we use Figma?

Figma is a really powerful design tool that allows designers to create mockups using our design system elements. Currently, our entire Paragon Design System is represented in Figma. This allows designers to pull components into their Figma mockups without having to re-invent the wheel.

When you receive a design in Figma, it may be overwhelming to understand how to pull information from it and translate the styling to Paragon or CSS. Fortunately, we have a recorded workshop that aims to walk you through this process. We’ll talk a bit more about the do’s and don’ts of CSS in the following section.

Action item: Watch a Figma Training (58 min)

Watch the following video (58 minutes) for an introduction to Figma. This workshop covers navigating through Figma files and translating designs to Paragon/React/CSS.

Figma Training for Engineers (Spec to Implementation)


Develop 🛠

React, and Redux, and Javascript, oh my!

Once you’ve gathered your requirements, it’s time to start coding! If you’re new to JavaScript, or you’re looking to improve your mental model, this https://justjavascript.com/ course may be a good resource for you. In Just JavaScript, Dan Abramov breaks down core JavaScript concepts to fill in gaps and enhance your understanding of JavaScript’s underlying functionality.

All of our microfrontends (MFEs) are written using ReactJS. If you’re new to React, take a look at the following resources to familiarize yourself with the framework and best practices.

Action Item: Read through React Component Best Practices

Regardless of your familiarity with React, it’s important to understand the conventions we try to promote at edX to maintain clean code and consistency. Read through these React Component Design Tips & Tricks to get a sense for how we structure React components.

For state management in React, we use Redux. If you’re new to state management, the Redux documentation is a good place to start to understand how to think in Redux: https://redux.js.org/understanding/thinking-in-redux/motivation. Understanding and working with Redux can be overwhelming at first, so take time to familiarize yourself with the repo you’re working in. Some repos, like frontend-app-learning, have ADRs (architecture decision records) that describe the structure of the code. This ADR from frontend-app-learning talks about the structure of its model store which uses Redux. Try finding an ADR for the repo you’re working in, and when in doubt, ask a team member or the frontend community in Slack!

CSS Do’s and Don’ts

In terms of styling, it may take some time to get used to translating Figma designs to code. While you’re styling your components, you’ll want to ask yourself, “Can I achieve this styling using Paragon/Bootstrap utility classes?” We generally want to avoid building custom CSS solutions for things that can be achieved using our design system utility classes.

Leaning on our design system allows us to avoid creating tech debt because our branding can remain centralized. This way, if we decide to update a major color like $brand, we only have to update it in our theme files, rather than chasing it down and replacing it in a number of different CSS files in different repos.

Here are a few examples of CSS do’s and don’ts:

Warning

Don’t hardcode colors

Code Block
languagesass
.myText {
  background-color: #0A3055
  color: #00BBF9;
}
Tip

Do use the color variables in our design system

Code Block
languagejsx
<span className="bg-primary text-accent-a">
  Welcome
</span>

Warning

Don’t hardcode font sizes, weight, etc.

Code Block
languagesass
.myText {
  line-height: 1.5rem;
  font-size: .875rem;
  font-weight: 400;
}
Tip

Do use the preset typography classes

Code Block
languagejsx
<span className="small">
  Welcome
</span>

Warning

Avoid using custom pixels for padding and margins

Code Block
languagesass
div {
  padding: 12px 16px;
  margin-right: 24px;
}
Tip

Do lean on and defer to the preset spacing classes

Code Block
languagejsx
<div className="py-2.5 px-3 mr-4">
  ...
</div>

When in doubt, search for what you’re attempting to style in Paragon’s list of CSS utility classes before creating custom CSS.

How to apply brand theming locally

When you’re developing in an MFE, all of the pages will be styled in the default Open edX theme. In order to apply a theme locally (for example, https://github.com/edx/brand-edx.org ), follow these steps: https://github.com/openedx/frontend-build#local-module-configuration-for-webpack

How to contribute to Paragon
Status
colourYellow
titleWIP

Note

Things to include/consider:

Contribution Process

https://github.com/edx/paragon#contributing--development

Writing a React component for Paragon (Study Group 1-26-2021)

https://github.com/edx/paragon#2-create-new-component

How to translate strings

Internationalization (i18n) is an important piece of the development process. Correctly formatting our strings for translation is crucial to avoid jeopardizing our user experience in different languages.

Action item: Familiarize yourself with string translation

Read through the following how-to guide for tips on how to format strings for translation.

https://openedx.atlassian.net/wiki/spaces/LOC/pages/3103293538/MFE+Translation+How+To+s

General resources and tutorials

React tutorials

CSS/Sass tutorials

Javascript tutorials


Test 🔍
Status
colourYellow
titleWIP

Note

Things to cover in this section:


Deploy 🚀
Status
colourYellow
titleWIP

Note

Things to cover in this section: