Skip to content

Commit

Permalink
Merge pull request IQSS#41 from IQSS/feature/add-buttons-and-dropdown…
Browse files Browse the repository at this point in the history
…s-of-the-design-system

32 - Add buttons and dropdowns of the design system
  • Loading branch information
kcondon authored Apr 14, 2023
2 parents 2a8c3ca + bf1b521 commit 0b8802c
Show file tree
Hide file tree
Showing 53 changed files with 726 additions and 540 deletions.
16 changes: 0 additions & 16 deletions .storybook/preview.ts

This file was deleted.

27 changes: 27 additions & 0 deletions .storybook/preview.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { Preview } from '@storybook/react'
import { ThemeProvider } from '../src/sections/ui/theme/ThemeProvider'
import DocumentationTemplate from '../src/stories/ui/DocumentationTemplate.mdx'

const preview: Preview = {
parameters: {
actions: { argTypesRegex: '^on[A-Z].*' },
controls: {
matchers: {
color: /(background|color)$/i,
date: /Date$/
}
},
docs: {
page: DocumentationTemplate
}
},
decorators: [
(Story) => (
<ThemeProvider>
<Story />
</ThemeProvider>
)
]
}

export default preview
14 changes: 13 additions & 1 deletion .stylelintrc.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
"scss/dollar-variable-pattern": null,
"scss/dollar-variable-empty-line-before": null,
"selector-id-pattern": null,
"selector-class-pattern": null
"selector-class-pattern": null,
"selector-pseudo-class-no-unknown": [
true,
{
"ignorePseudoClasses": ["export"]
}
],
"property-no-unknown": [
true,
{
"ignoreSelectors": [":export"]
}
]
}
}
17 changes: 0 additions & 17 deletions src/assets/styles/_bootstrap-customized.scss

This file was deleted.

4 changes: 0 additions & 4 deletions src/assets/styles/_bootstrap-utils.scss

This file was deleted.

3 changes: 0 additions & 3 deletions src/assets/styles/_bootstrap-variables.scss

This file was deleted.

27 changes: 0 additions & 27 deletions src/assets/styles/_colors.scss

This file was deleted.

5 changes: 0 additions & 5 deletions src/assets/styles/_typography.scss

This file was deleted.

2 changes: 0 additions & 2 deletions src/assets/styles/index.scss

This file was deleted.

6 changes: 4 additions & 2 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
import React from 'react'
import ReactDOM from 'react-dom/client'
import './assets/styles/index.scss'
import App from './App'
import reportWebVitals from './reportWebVitals'
import './i18n'
import { ThemeProvider } from './sections/ui/theme/ThemeProvider'

const root = ReactDOM.createRoot(document.getElementById('root') as HTMLElement)
root.render(
<React.StrictMode>
<React.Suspense fallback="loading">
<App />
<ThemeProvider>
<App />
</ThemeProvider>
</React.Suspense>
</React.StrictMode>
)
Expand Down
2 changes: 1 addition & 1 deletion src/sections/hello-dataverse/HelloDataverse.module.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
@import "src/assets/styles/colors";
@import "src/sections/ui/assets/styles/design-tokens/colors.module";

.container {
display: flex;
Expand Down
2 changes: 1 addition & 1 deletion src/sections/layout/Layout.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Outlet } from 'react-router-dom'
import { Header } from './header/Header'
import { Container } from '../ui/grid/container/Container'
import { Container } from '../ui/grid/Container'
import { Footer } from './footer/Footer'
import styles from './Layout.module.scss'

Expand Down
4 changes: 2 additions & 2 deletions src/sections/layout/footer/Footer.module.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "src/assets/styles/colors";
@import "src/assets/styles/typography";
@import "src/sections/ui/assets/styles/design-tokens/colors.module";
@import "src/sections/ui/assets/styles/design-tokens/typography.module";

.container {
padding: 60px 0;
Expand Down
6 changes: 3 additions & 3 deletions src/sections/layout/footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Container } from '../../ui/grid/container/Container'
import { Row } from '../../ui/grid/row/Row'
import { Col } from '../../ui/grid/col/Col'
import { Container } from '../../ui/grid/Container'
import { Row } from '../../ui/grid/Row'
import { Col } from '../../ui/grid/Col'
import styles from './Footer.module.scss'
import dataverseProjectLogo from './dataverse-project-logo.svg'
import { useTranslation } from 'react-i18next'
Expand Down
68 changes: 68 additions & 0 deletions src/sections/ui/assets/styles/bootstrap-customized.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
@import "src/sections/ui/assets/styles/design-tokens/typography.module";
@import "src/sections/ui/assets/styles/design-tokens/colors.module";

// Theme

$primary: $dv-primary-color;
$secondary: $dv-secondary-color;
$success: $dv-success-color;
$info: $dv-info-color;
$warning: $dv-warning-color;
$danger: $dv-danger-color;

@import "node_modules/bootstrap/scss/functions";
@import "node_modules/bootstrap/scss/variables";
@import "node_modules/bootstrap/scss/mixins";

// Body
$body-color: $dv-text-color;
$headings-color: $dv-headings-color;

// Typography
$font-family-base: $dv-font-family;

$font-size-base: $dv-font-size;
$font-size-sm: $dv-font-size-sm;

$line-height-base: $dv-line-height;

$font-weight-normal: $dv-font-weight;
$font-weight-light: $dv-font-weight-light;
$font-weight-bold: $dv-font-weight-bold;

// Links
$link-color: $dv-link-color;
$link-hover-color: $dv-link-hover-color;

// Base
@import "node_modules/bootstrap/scss/maps";
@import "node_modules/bootstrap/scss/root";
@import "node_modules/bootstrap/scss/reboot";
@import "node_modules/bootstrap/scss/type";

// Buttons and Dropdowns
@import "bootstrap/scss/buttons";
@import "bootstrap/scss/dropdown";

// Grid
@import "node_modules/bootstrap/scss/utilities";
@import "node_modules/bootstrap/scss/utilities/api";
@import "node_modules/bootstrap/scss/containers";
@import "node_modules/bootstrap/scss/grid";

// Badge
@import "bootstrap/scss/badge";

// Navbar

$navbar-light-brand-color: $dv-brand-color;
$navbar-brand-font-size: $dv-brand-font-size;

@import "bootstrap/scss/nav";
@import "bootstrap/scss/navbar";
@import "bootstrap/scss/transitions";
@import "bootstrap/scss/helpers";

.navbar-collapse {
justify-content: end;
}
46 changes: 46 additions & 0 deletions src/sections/ui/assets/styles/design-tokens/colors.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Base colors
$dv-brand-color: #C55B28;
$dv-primary-color: #337AB7;
$dv-secondary-color: #6c757d;
$dv-success-color: #3c763d;
$dv-danger-color: #a94442;
$dv-warning-color: #8a6d3b;
$dv-info-color: #31708f;
$dv-success-box-color: #dff0d8;
$dv-danger-box-color: #f2dede;
$dv-warning-box-color: #fcf8e3;
$dv-info-box-color: #d9edf7;

// Text colors
$dv-text-color: #333;
$dv-subtext-color: #767676;

$dv-primary-text-color: white;
$dv-secondary-text-color: $dv-text-color;

$dv-headings-color: #333;

// Link colors
$dv-link-color: #3174AF;
$dv-link-hover-color: #23527c;

:export {
brand: $dv-brand-color;
primary: $dv-primary-color;
secondary: $dv-secondary-color;
textColor: $dv-text-color;
subTextColor: $dv-subtext-color;
primaryTextColor: $dv-primary-text-color;
secondaryTextColor: $dv-secondary-text-color;
headingsColor: $dv-headings-color;
linkColor: $dv-link-color;
linkHoverColor: $dv-link-hover-color;
successColor: $dv-success-color;
dangerColor: $dv-danger-color;
warningColor: $dv-warning-color;
infoColor: $dv-info-color;
successBoxColor: $dv-success-box-color;
dangerBoxColor: $dv-danger-box-color;
warningBoxColor: $dv-warning-box-color;
infoBoxColor: $dv-info-box-color;
}
22 changes: 22 additions & 0 deletions src/sections/ui/assets/styles/design-tokens/typography.module.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
$dv-font-size: 16px;
$dv-font-size-sm: 12px;
$dv-brand-font-size: 24px;

$dv-font-family: ("Helvetica Neue",helvetica,arial,sans-serif);

$dv-font-weight: 400;
$dv-font-weight-light: 300;
$dv-font-weight-bold: 700;

$dv-line-height: 1.5;

:export {
fontSize: $dv-font-size;
fontSizeSm: $dv-font-size-sm;
brandFontSize: $dv-brand-font-size;
fontFamily: $dv-font-family;
fontWeight: $dv-font-weight;
fontWeightLight: $dv-font-weight-light;
fontWeightBold: $dv-font-weight-bold;
lineHeight: $dv-line-height;
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@
font-weight: normal;
font-family: fontcustom;
font-style: normal;
src: url("src/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.eot");
src: url("src/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.eot?#iefix") format("embedded-opentype"),
url("src/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.woff2") format("woff2"),
url("src/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.woff") format("woff"),
url("src/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.ttf") format("truetype"),
url("src/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.svg#fontcustom") format("svg");
src: url("src/sections/ui/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.eot");
src: url("src/sections/ui/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.eot?#iefix") format("embedded-opentype"),
url("src/sections/ui/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.woff2") format("woff2"),
url("src/sections/ui/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.woff") format("woff"),
url("src/sections/ui/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.ttf") format("truetype"),
url("src/sections/ui/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.svg#fontcustom") format("svg");
}

@media screen and (min-resolution) {
@font-face {
font-family: fontcustom;
src: url("src/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.svg#fontcustom") format("svg");
src: url("src/sections/ui/assets/fontcustom/fontcustom_8c9f858763dbca8e064e7fd59d1aa2b7.svg#fontcustom") format("svg");
}
}

Expand Down
2 changes: 2 additions & 0 deletions src/sections/ui/assets/styles/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@import "src/sections/ui/assets/styles/fontcustom";
@import "src/sections/ui/assets/styles/bootstrap-customized";
11 changes: 11 additions & 0 deletions src/sections/ui/badge/Badge.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { Badge as BadgeBS } from 'react-bootstrap'
import { ReactNode } from 'react'

interface BadgeProps {
variant: 'primary' | 'secondary' | 'success' | 'danger' | 'warning' | 'info'
children: ReactNode
}

export function Badge({ variant, children }: BadgeProps) {
return <BadgeBS bg={variant}>{children}</BadgeBS>
}
1 change: 0 additions & 1 deletion src/sections/ui/button/Button.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { ReactNode } from 'react'
import styles from './Button.module.scss'
import './button.scss'
import { Button as ButtonBS } from 'react-bootstrap'
import { Icon } from '../icon.enum'

Expand Down
7 changes: 0 additions & 7 deletions src/sections/ui/button/button.scss

This file was deleted.

1 change: 0 additions & 1 deletion src/sections/ui/dropdown-button/DropdownButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { DropdownButton as DropdownButtonBS } from 'react-bootstrap'
import { ReactNode } from 'react'
import './dropdown-button.scss'
import styles from './DropdownButton.module.scss'
import { Icon } from '../icon.enum'

Expand Down
3 changes: 0 additions & 3 deletions src/sections/ui/dropdown-button/dropdown-button.scss

This file was deleted.

Loading

0 comments on commit 0b8802c

Please sign in to comment.