-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from Teradata/feat/tab-chip-banner
Feat/tab-chip-banner
- Loading branch information
Showing
34 changed files
with
767 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,62 +1,49 @@ | ||
# WebDesignSystem | ||
# Web design system | ||
|
||
<a alt="Nx logo" href="https://nx.dev" target="_blank" rel="noreferrer"><img src="https://raw.githubusercontent.com/nrwl/nx/master/images/nx-logo.png" width="45"></a> | ||
Web design system is a collection of reusable component libraries designed to streamline the development process and enhance the user interface of your web applications. | ||
|
||
✨ **This workspace has been generated by [Nx, Smart Monorepos · Fast CI.](https://nx.dev)** ✨ | ||
## Features | ||
|
||
## Integrate with editors | ||
- **Reusable Components:** Currently Web design system provides a variety of reusable React components that you can easily integrate into your projects. | ||
- **Responsive:** Our components are built with responsiveness in mind, ensuring that they look and function seamlessly across different screen sizes and devices. | ||
|
||
Enhance your Nx experience by installing [Nx Console](https://nx.dev/nx-console) for your favorite editor. Nx Console | ||
provides an interactive UI to view your projects, run tasks, generate code, and more! Available for VSCode, IntelliJ and | ||
comes with a LSP for Vim users. | ||
## Installation | ||
|
||
## Start the application | ||
|
||
Run `npx nx serve web-design-system` to start the development server. Happy coding! | ||
|
||
## Build for production | ||
|
||
Run `npx nx build web-design-system` to build the application. The build artifacts are stored in the output directory (e.g. `dist/` or `build/`), ready to be deployed. | ||
|
||
## Running tasks | ||
|
||
To execute tasks with Nx use the following syntax: | ||
|
||
``` | ||
npx nx <target> <project> <...options> | ||
``` | ||
|
||
You can also run multiple targets: | ||
You can install react components offered by the Web design system via npm or yarn: | ||
|
||
``` | ||
npx nx run-many -t <target1> <target2> | ||
```bash | ||
npm install @teradata-web/react-components | ||
``` | ||
|
||
..or add `-p` to filter specific projects | ||
or | ||
|
||
``` | ||
npx nx run-many -t <target1> <target2> -p <proj1> <proj2> | ||
```bash | ||
yarn add @teradata-web/react-components | ||
``` | ||
|
||
Targets can be defined in the `package.json` or `projects.json`. Learn more [in the docs](https://nx.dev/features/run-tasks). | ||
## Usage | ||
|
||
## Set up CI! | ||
To use a component from Web design system, simply import it into your React application and render it: | ||
|
||
Nx comes with local caching already built-in (check your `nx.json`). On CI you might want to go a step further. | ||
```jsx | ||
import React from 'react'; | ||
import { Button } from '@teradata-web/react-components'; | ||
|
||
- [Set up remote caching](https://nx.dev/features/share-your-cache) | ||
- [Set up task distribution across multiple machines](https://nx.dev/nx-cloud/features/distribute-task-execution) | ||
- [Learn more how to setup CI](https://nx.dev/recipes/ci) | ||
const App = () => { | ||
return ( | ||
<div> | ||
<Button onClick={() => alert('Button clicked!')}>Click me</Button> | ||
</div> | ||
); | ||
}; | ||
|
||
## Explore the project graph | ||
|
||
Run `npx nx graph` to show the graph of the workspace. | ||
It will show tasks that you can run with Nx. | ||
export default App; | ||
``` | ||
|
||
- [Learn more about Exploring the Project Graph](https://nx.dev/core-features/explore-graph) | ||
## Documentation | ||
|
||
## Connect with us! | ||
For documentation on each component, including usage examples and available props, please run the below command: | ||
|
||
- [Join the community](https://nx.dev/community) | ||
- [Subscribe to the Nx Youtube Channel](https://www.youtube.com/@nxdevtools) | ||
- [Follow us on Twitter](https://twitter.com/nxdevtools) | ||
```bash | ||
npx nx run react-components:storybook | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 42 additions & 0 deletions
42
libs/react-components/src/lib/components/Banner/Banner.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import Banner from './index'; | ||
import Button from '../Button'; | ||
|
||
const demoContent = ( | ||
<p> | ||
There are situations when you want to quickly validate a machine learning | ||
model idea. You have a model type in mind. You don't want to operationalize | ||
with an ML pipeline just yet. You just want to test out if the relationship | ||
you had in mind exists. Also, sometimes even your production deployment | ||
doesn't require constant relearning with MLops. In such cases, you can use | ||
Vantage Analytics Library (VAL) and multiple ML model types it supports. | ||
</p> | ||
); | ||
|
||
const meta = { | ||
title: 'Components/Banner', | ||
component: Banner, | ||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs | ||
tags: ['autodocs'], | ||
parameters: { | ||
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout | ||
layout: 'fullscreen', | ||
}, | ||
args: { | ||
content: ( | ||
<> | ||
{demoContent} | ||
<Button label="Get started" icon="fa fa-arrow-right" trailingIcon /> | ||
</> | ||
), | ||
imageSrc: | ||
'https://www.teradata.com/getmedia/46d83f57-61b3-43aa-84a4-4cfbd408a1fa/roles-business_leader.svg?origin=fd', | ||
title: 'Train ML models in Vantage', | ||
}, | ||
} satisfies Meta<typeof Banner>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
import React, { ReactNode } from 'react'; | ||
import styles from './styles.module.scss'; | ||
|
||
interface BannerProps { | ||
/** | ||
* Content to be displayed in the banner. Accepts any ReactNode. | ||
*/ | ||
content: ReactNode; | ||
/** | ||
* Source for the banner image. | ||
*/ | ||
imageSrc: string; | ||
/** | ||
* Alt text for the banner image. | ||
*/ | ||
imageAltText?: string; | ||
/** | ||
* Title of the banner. | ||
*/ | ||
title: string; | ||
} | ||
|
||
const Banner: React.FC<BannerProps> = ({ | ||
content = '', | ||
imageSrc = '', | ||
imageAltText = 'Banner Image', | ||
title = '', | ||
}) => { | ||
return ( | ||
<div className={styles.banner}> | ||
<section className={styles.bannerInfo}> | ||
<h3 className={styles.bannerTitle}>{title}</h3> | ||
<div className={styles.bannerContent}>{content}</div> | ||
</section> | ||
<img className={styles.bannerImage} src={imageSrc} alt={imageAltText} /> | ||
</div> | ||
); | ||
}; | ||
|
||
export default Banner; |
51 changes: 51 additions & 0 deletions
51
libs/react-components/src/lib/components/Banner/styles.module.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
.banner { | ||
align-items: center; | ||
background-color: inherit; | ||
box-sizing: border-box; | ||
display: flex; | ||
flex-direction: column-reverse; | ||
font-family: var(--mdc-typography-headline5-font-family); | ||
gap: 2rem; | ||
justify-content: space-between; | ||
margin: 0 auto; | ||
max-width: 1440px; | ||
min-width: 100%; | ||
} | ||
|
||
.bannerTitle { | ||
color: var(--td-web-primary-navy); | ||
font-size: var(--mdc-typography-headline5-font-size); | ||
font-weight: var(--mdc-typography-headline3-font-weight); | ||
letter-spacing: -0.24px; | ||
line-height: var(--mdc-typography-headline4-font-size); | ||
margin: 0; | ||
} | ||
|
||
.bannerContent { | ||
color: var(--td-web-gray-700); | ||
font-size: 1.125rem; | ||
margin-top: 1rem; | ||
} | ||
|
||
.bannerInfo, | ||
.bannerImage { | ||
flex: 1 0 100%; | ||
max-width: 100%; | ||
width: 100%; | ||
} | ||
|
||
@media screen and (min-width: 768px) { | ||
.banner { | ||
flex-direction: row; | ||
} | ||
|
||
.bannerImage { | ||
flex: 1 0 calc(47.5% - 50px); | ||
max-width: calc(47.5% - 50px); | ||
} | ||
|
||
.bannerInfo { | ||
flex: 1 0 50%; | ||
max-width: 50%; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
libs/react-components/src/lib/components/Button/Button.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import type { Meta, StoryObj } from '@storybook/react'; | ||
|
||
import Button from './index'; | ||
|
||
const meta = { | ||
title: 'Components/Button', | ||
component: Button, | ||
// This component will have an automatically generated Autodocs entry: https://storybook.js.org/docs/writing-docs/autodocs | ||
tags: ['autodocs'], | ||
parameters: { | ||
// More on how to position stories at: https://storybook.js.org/docs/configure/story-layout | ||
layout: 'fullscreen', | ||
}, | ||
args: { | ||
label: 'Data engineer', | ||
size: 'medium', | ||
primary: true, | ||
icon: 'fa fa-arrow-right', | ||
trailingIcon: false, | ||
}, | ||
} satisfies Meta<typeof Button>; | ||
|
||
export default meta; | ||
type Story = StoryObj<typeof meta>; | ||
|
||
export const Basic: Story = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.