How deriv-com/quill-ui works
Project Type & Purpose
• This is an open-source UI component library intended to standardize and simplify the creation of user interfaces for Deriv applications.
• Its primary goal is to promote design consistency (via design tokens and integration with the Design System) and facilitate easy usage/development through Storybook demos and thorough testing.
Main Components
a. Component Library (lib/components)
– Within each component (for example, “ActionSheet”, “Atom”, “Badge”, etc.), indicate that they follow modular design with support files like SCSS styling, tests, and story files.
b. Core Hooks (lib/hooks)
– Represent hooks (e.g., useTheme, useDropdown, usePaginationRange) as a separate node.
– Highlight that these hooks provide reusable state and UI behavior logic across components.
c. Providers (lib/providers)
– Indicate connections from the providers to both hooks and the component library (they connect at higher levels to manage global state).
d. Utility Functions & Types (lib/utils and lib/types)
– Show a node for utility modules that support common operations (e.g., common-utils, notification-utils, typography-utils).
– Include the types definition files that help maintain type safety across the project.
e. Design Tokens & Styling (data and lib/styles)
– Show design tokens (stored, for example, in data/tokens.json) and the styles folder.
– Emphasize that the style and theming are entirely design token driven for consistency with the Deriv Design System.
f. Development & Demonstration Infrastructure
– Storybook (in the .storybook folder) is a critical component for demonstrating and testing each UI element.
– Include testing frameworks and configuration files (e.g., Jest tests across components; configuration via .eslintrc.cjs, commitlint, and husky for precommit checks).
– Also denote build configuration (vite.config.ts and various tsconfig files) and release pipelines (release.config.cjs, release.utils.cjs, and GitHub workflows).
Relationships and Interactions
• The UI components make use of hooks and providers.
• Providers supply themes and global states to the components.
• Utilities and type definitions support both components and hooks.
• The storybook node can be connected to the components as a demonstration and documentation layer.
• The build/configuration tools support the overall project by automating tests, linting, and releases (npm publishing).
Architectural Patterns and Design Principles
• Modular design: each component is self-contained with tests, styles, and stories.
• Document design system integration: the styling is token-driven, meaning that changing tokens alters the whole UI, ensuring consistency.
• Best practices such as context providers and custom hooks for state management.