Giter VIP home page Giter VIP logo

onyxia-ui's Introduction

The Onyxia UI toolkit


Documentation

This project is a React UI toolkit that implement a design system created for Onyxia by Marc Hufschmitt.

This project provide some custom components but you can also use any MUI component they will be automatically styled to fit the design system.

  • Optimized for typescript, theme customization without module augmentation.
  • Built in support for the dark mode.
  • If you want to diverge from the Onyxia Design system, the theme is customizable, you can for example change the fonts and the colors.
  • Provide splash screen that hide the screen when needed.
  • Icons are downloaded at runtime. The full catalog of mui icons is is available at runtime. (No hard import required)

Disclaimer: onyxia-ui is specifically designed to build SPA and is not SSR compatible.

A note about the integration of Onyxia and Onyxia-UI can be found here.

Showcase

Quick start

yarn add onyxia-ui @mui/material @emotion/react @emotion/styled

Icons

Onyxia-ui enables you to use icons from the Material Design Library.
Or to provide your own icon as SVG urls.

Using Material Icons: With hard import

If you know what icon you'll need ahead of time, implement this approach:

yarn add @mui/icons-material

src/theme.ts

const { ThemeProvider } = createThemeProvider({
    // ...
    publicUrl: undefined,
});

Now if you want to use AccessAlarms

import AccessAlarmIcon from "@mui/icons-material/AccessAlarm";

<Icon icon={AccessAlarmIcon} />;

Using Material Icons: With lazy loading

If you don't know ahead of time what icon you will need. This is the case if your app renders user generated content that might include icons then you can opt for downloading the icons dynamically.
Be aware that this involves including a 35MB directory of icons in your public/ directory which will end up impacting your docker image size.

"scripts": {
    "prepare": "copy-material-icons-to-public"
}

OPTIONAL: Use cache in your Workflow to speed up your CI pipeline

    - uses: bahmutov/npm-install@v1
      env:
        XDG_CACHE_HOME: "/home/runner/.cache/yarn"

This will enable you to do this:

import { Icon } from "onyxia-ui/Icon";

// https://mui.com/material-ui/material-icons/?selected=AccessAlarms
<Icon icon="AccessAlarms" />;

Or, if you want type safety:

import { Icon } from "onyxia-ui/Icon";
import { id } from "tsafe/id";
import type { MuiIconComponentName } from "onyxia-ui/MuiIconComponentName";

// https://mui.com/material-ui/material-icons/?selected=AccessAlarms
<Icon icon={id<MuiIconComponentName>("AccessAlarms")} />;

Using custom SVGs as icons

import myIconSvgUrl from "./assets/my-icon.svg";

<Icon icon={myIconSvgUrl} />
<Icon icon="https://example.com/foo/my-icon.svg" />

Documentation

The documentation is under the form of a very simple demo project.
The actual theme configuration happens here.
If you want to experiment with it you can run the demo app with:

NOTE for Storybook users: As of writing this lines storybook still uses by default emotion 10.
mui and TSS runs emotion 11 so there is some changes to be made to your .storybook/main.js to make it uses emotion 11.

Launch dev environment

git clone https://github.com/garronej/onyxia-ui
cd onyxia-ui
yarn
yarn build
yarn start

onyxia-ui's People

Contributors

actions-user avatar ddecrulle avatar garronej avatar marchufschmitt avatar paulgehin avatar pengfei99 avatar renovate[bot] avatar thieryw avatar tongyeouki 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

Watchers

 avatar  avatar

onyxia-ui's Issues

Button keeps their 'hover' state when clicked.

We should keep MUI default behaviour for hover.
This PR was a good temporary patches but it has too many negative side effects.

The real solution is to use a screen scaller that support the use of getBoundingClientRect and other measurement API.
I've started a work toward this: https://github.com/garronej/react-screen-scaler
When we can replace powerhooks's ViewPortProvider with react-screen-scaler all issues related to touch ripple missplacement should go away. It should also solves the misssizing of dropdowns.

Distinguish training page and documentation page on the front page

As discussed lately with @marchufschmitt and @garronej, the documentation of Onyxia is currently very hard to reach : one has to go through the Training section to get to it.

I'd suggest putting two separate buttons in the headers :

  • Training
  • Documentation

To avoid bloating the headers, the new button could replace the "Community Space" one : it's a nice looking page, but it's not very useful in itself. Maybe some nice elements from this page could be merged with the Datalab front page.

@fcomte

Strange design behavior of buttons in Dialog

Hey, I just played around in your deployed Storybook and I noticed some flickering when I'm checking the checkbox in the Dialog story. See GIF attached. I was just wondering if this is intended?

2021-07-27-12-45-08

I'm on Win10 and used Firefox and also checked with Firefox Dev Edition.

Cheers.

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.