Coder Social home page Coder Social logo

brainly / style-guide Goto Github PK

View Code? Open in Web Editor NEW
161.0 48.0 30.0 31.12 MB

:art: Brainly Front-End Style Guide

Home Page: https://styleguide.brainly.com/

License: Other

JavaScript 6.97% Shell 0.07% HTML 0.06% Dockerfile 0.02% SCSS 9.22% CSS 0.06% Makefile 0.03% TypeScript 58.90% MDX 24.66%
style-guide css bem-methodology frontend-components react-components

style-guide's Introduction

Brainly Style Guide

This project is a living style guide of all basic front-end components used at Brainly.

Documentation

Documentation is an esential part of this project. You can see its latest version on styleguide.brainly.com. New version of the docs is deployed with every merge to master. You can also browse older versions by changing version number in the URL. Documentation is splitted into four sections:

  • Basics - colors, fonts, icons, simple components
  • Components - complex components
  • Containers - components that host other components
  • Interactive - interactive version of the style guide docs that we are experimenting with

Storybook

Current version of storybook is hosted under following dev URL - styleguide.brainly.com

How to use it

All components can be used in both HTML and JSX. In both cases you have to include main CSS file, as described on the main docs page, in the head section of your page. In case of HTML, you just have to follow style-guide markup which you can easily copy by clicking on any component in the docs. If you prefer to use React instead, you'll have to add this repository as a dependency in package.json and import components into your JSX file.

Supported Browsers

We officially support the following browsers (based on real user trafic from our analytics):

Browser Versions
Google Chrome 28+
Safari 7+
Samsung Internet 1.1+
YaBrowser 15+
Android Webview 30+
Firefox 42+
UCBrowser 8+
Android Browser 4.0+
Opera 33+
Opera Mini 7+
Edge 12+

Note: You can find all recent stats in our analytics (INTERNAL)

Contributing

We welcome all issue reports and pull requests ❤️ If you'd like to contribute, please start with this doc.

Caveats

  • Package "s3" has been forked to @brainly organization. One of dependencies of this package (graceful-fs) was causing our builds to fail. Since this package is no longer maintained, we decided to fork it and make needed updates. As a long-term solution, we need to switch "s3" package to something more up-to-date.

Codemods

We created a CLI tool that runs codemods with jscodeshift to batch refactor code. Usage:

yarn sg-codemod [...options]

where options are:

  • --help - display help
  • --dry - dry run (no changes are made to files)
  • --glob - use glob pattern to match files
  • --jscodeshift - pass options directly to jscodeshift

Read more here.

style-guide's People

Contributors

anna-wro avatar bartoszlorek avatar burakukula avatar clxandstuff avatar coderitual avatar dependabot[bot] avatar domidomi avatar elakrk avatar elalukaszewicz avatar ensisf avatar fasosnql avatar jakubjasiolek avatar katarzynatobis avatar kdzwinel avatar krzotki avatar lewandowskid avatar maciekbb avatar malinicz avatar matikrk avatar matzimowski avatar mkudej avatar mr-mig avatar patrycja-b avatar pinkaminadianepie avatar przytrzask avatar rkty13 avatar seahindeniz avatar sheppard30 avatar tomasz-sodzawiczny avatar vergilius avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

style-guide's Issues

Designing containers

We should bear in mind (and tell out designers), that any container should be designed for this cases:

  • zero children
  • one children
  • many children

The same goes for text containers, it will help handle overflows.

Fix button with stars

screen shot 2015-08-04 at 18 08 42
On hovering over first area one star should be active, on second 5 stars should be active

New avatars

Avatars have changed.
See brainly/web-client#111 and brainly/symfony#1511 https://github.com/brainly/symfony/issues/1624
brainly/web-client#103

Summ up:

  • Change sizes
  • Change default avatar icon

Edit:
According to Janusz:
Ok. Final decision is: we have three sizes of avatars:

  1. 24px with 1px border inside
  2. 32px with 1px border inside
  3. 48px with 2px border inside

Add @fix-font mixin to deal with text centering

We have a problem with our font's baseline (and all general labels we have): the line-height and font-size does not play well together, forcing the baseline to shift 1px.

If we fix line-height, font-size and height of the text wrapping elements we can get more precise centering (see gray area for the rightmost number):

http://i.gyazo.com/7585e59aa8150ba6f115483a14013f0c.png

Create icons components

Icons can be wrapped in elements with predefined color, so that we can use actual elements instead of :before and have centralized styles for icons

Add separator

It should be 1px dotted $grayPrimary, used mainly in streams

Fix indent in atoms

User nick should have 16px margin to avatar.
Text content below should be in the same line with user nick.
screen shot 2015-08-13 at 12 16 38

Colors on buttons (states)

We need to review states of buttons (border and icon colors), Joanna proposed inversion of current colors (border darker on active/focus the same as on inputs). Also we need to discuss how "best" button should act on active/hover etc.

cc. @matzimowski

subject icons should not be separate

IMO subject icons should be just added to the default icon set. I don't see any reason to keep them separate. Also, currently they are made using background-image instead of content: '' which makes it impossible to change their color (if we'll ever need that).

Andrzej's argument was that subjects are used only on the main page so we don't have to load them for ppl only visiting the question page reducing page size. Hovers, IMO that's a premature optimization and judging from the mocks, the assumption that subjects are used only on the main page wasn't true:

screen shot 2015-08-05 at 18 09 10

Moving components variables to the components

I think it would be better to move components variables to component scss file. Things like $buttonFont: $mintFontPrimary;

The benefits we get:

  • Components and their "settings" are encapsulated in a single file
    • Easier to reason about variable dependencies
    • Easier to change component-related configuration
    • Easier to grasp component parameterization
  • Global configuration is separated from local

WDYT? @kdzwinel @aju @matzimowski @vergilius

Create icons components

Icons can be wrapped in elements with predefined color, so that we can use actual elements instead of :before and have centralized styles for icons

Text padding issue

When we have a text elements (e.g. mint-text-description) or a container with text content (see mint-content-box__content), we have a problem with padding.

According to mockup, the exact padding between text and avatars is 12px:

But in HTML we have additional padding for text, which cannot be overriden (smth like 1-2px).
Additionaly we have the offset for the font baseline approx. 2-3px.
You can see how those padding add up to 12px gap giving us unconsistend paddings for text content:

Badge animation breaks avatars

While badge animation (katie) is running avatars are square instead of round. Reproducible on the styleguide components page.

screen shot 2015-08-14 at 10 04 26

Add default height to all components

We have problems in some cases trying to align different components vertically as they tend to have very weird and different heights, like 18px and 19px (this is magnified by font issues, when baseline get 1px at the top or bottom depending on oddness of the font size).

I'd propose to add explicit height to the @component so that we have at least some default height for all things.

Flex-box for layouting

I would propose to use flexbox styles for vertical and inline positioning of components (push to left/right/botton, centering) instead of relying on inline-block + position/vertical-align.

Make all :before-based icons `display:block`

If icons will remain inline-block they inherit the baseline and get additional pixels at top/bottom, which ruins the vertical centering.

We need to make all icons to be display:block to get closer to pixel-perfect centering

Change docs-block to have flexbox display

We've checked this snippet:

.docs-block {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-start;
}

It works ok but requires some changes to the htmls and some element fixes

Having a single %component placeholder

Given a nature of components we have, it seems we can base all our block on smth like that:

%component {
  box-sizing: border-box;
  display: inline-block;
  position: relative;
  overflow: hidden;
  text-overflow: ellipsis;
}

WDYT?
Do we need to add resets there as well?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.