diff --git a/.prettierrc.json b/.prettierrc similarity index 100% rename from .prettierrc.json rename to .prettierrc diff --git a/README.md b/README.md index 39194a3..42645b9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ -# Vite React Component Library Starter +# RSE React Library -This is a starter template for creating React component libraries using Vite. It includes a robust set of features to help you develop, test, and build your library efficiently. +This is a collection of react components that RSE uses in majority of React Web projects. ## Features @@ -15,6 +15,50 @@ This is a starter template for creating React component libraries using Vite. It - Husky: A pre-commit hook. - Github Action: A tool that deploys your Storybook to GitHub page automatically. + + +## Usage + +RSE React Library is available as an [npm package](https://www.npmjs.com/package/@toyota-research-institute/rse-react-library). + +```sh +// with npm +npm install @toyota-research-institute/rse-react-library + +// with yarn +yarn add @toyota-research-institute/rse-react-library +``` + +Material Tailwind's `ThemeProvider` must wrap your application for the components to style correctly. +``` +import { ThemeProvider } from '@material-tailwind/react'; + + + ... + +``` + +Here is a quick example to get you started: + +```jsx +import { createRoot } from 'react-dom/client'; +import { TRIApp } from '@toyota-research-institute/rse-react-library'; +import '@toyota-research-institute/rse-react-library/style.css'; +import config from './tri.app.config'; + +function App() { + return ; +} + +createRoot.render(, document.querySelector('#app')); +``` + +## How to use + +1. Clone this repository +2. Install dependencies using `npm i` (or `pnpm i` if you like) + + ## Get Started 1. Clone this repository diff --git a/lib/feedback/env.d.ts b/lib/feedback/env.d.ts new file mode 100644 index 0000000..6868ef3 --- /dev/null +++ b/lib/feedback/env.d.ts @@ -0,0 +1,7 @@ +interface Window { + showCollectorDialog(): void; + + ATL_JQ_PAGE_PROPS: null | { + triggerFunction: (fn: ShowDialogFn) => void; + }; +} diff --git a/lib/layout/FeedbackButton.tsx b/lib/layout/FeedbackButton.tsx index 99c6e6d..8f4d0d2 100644 --- a/lib/layout/FeedbackButton.tsx +++ b/lib/layout/FeedbackButton.tsx @@ -1,20 +1,20 @@ // FeedbackButton.tsx import { Button } from '@material-tailwind/react'; -import { useFeedback } from '../feedback/use-feedback'; +// import { useFeedback } from '../feedback/use-feedback'; const FeedbackButton = () => { - const { showDialog } = useFeedback(); + // const { showDialog } = useFeedback(); return ( - showDialog && ( + window.showCollectorDialog && (
diff --git a/lib/tri-app.tsx b/lib/tri-app.tsx index da0a8a5..cf20f79 100644 --- a/lib/tri-app.tsx +++ b/lib/tri-app.tsx @@ -1,6 +1,6 @@ import {} from 'aws-amplify'; import { type ReactElement, createContext, useContext } from 'react'; -import FeedbackProvider from './feedback/FeedbackProvider'; +// import FeedbackProvider from './feedback/FeedbackProvider'; import CognitoProvider from './amplify/cognito-provider'; import AppLayout from './layout/AppLayout'; @@ -33,11 +33,9 @@ interface TRIAppProps { const TRIApp = ({ config, PreloginPage }: TRIAppProps) => { return ( - - - - - + + + ); };