Install
npm install @barbora-delivery/merchant-ui
If that doesn't work, make sure to follow the steps for Retrieving private packages.
Quickstart
import { defineMessages } from 'react-intl'
import { Navigate, Outlet, ReactLocation, Router } from '@tanstack/react-location'
import { parseSearch, stringifySearch } from '@tanstack/react-location-jsurl'
import { ErrorTranslationContextProvider, LocaleContextProvider } from '@barbora-delivery/merchant-ui'
import '../node_modules/@barbora-delivery/merchant-ui/dist/tailwind.css'
export const formErrorsMessages = defineMessages({
REQUIRED: {
id: `form-errors.REQUIRED`,
defaultMessage: 'Required',
},
FILL_ZONE_NAME: {
id: `form-errors.FILL_ZONE_NAME`,
defaultMessage: 'Fill Zone name first',
},
} as const)
const location = new ReactLocation<LocationGenerics>({ parseSearch, stringifySearch })
const App: React.FC = () => {
return (
<LocaleContextProvider initialValue={'en'}>
<ErrorTranslationContextProvider initialValue={formErrorsMessages}>
<Router location={location} routes={[]}><Outlet /><Router>
</ErrorTranslationContextProvider>
</LocaleContextProvider>
)
}