Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dokan vendor dashboard react router dev doc #2404

Open
wants to merge 1 commit into
base: update/vendor-dashboard-structure
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 67 additions & 0 deletions docs/dokan-routes.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Register a new `route` and `component` in dokan lite.

## Create `custom-tailwind.config.js` in your directory
```js
import baseConfig from '../../base-tailwind.config'; // update the location according to your location

/** @type {import('tailwindcss').Config} */
const updatedConfig = {
...baseConfig,
content: [
...baseConfig.content,
'./src/{your-path}/**/*.{js,jsx,ts,tsx}', // update the location according to your location
],
};

export default updatedConfig;
```

## Create `tailwind.scss` in your directory
⚠️ Make sure you imported `dokan-ui.css` if you are using [Dokan ui components](https://www.npmjs.com/package/@getdokan/dokan-ui)
```scss
@config './custom-tailwind.config.js'; // update the location according to your location
@import "@/base-tailwind";
// @import "@getdokan/dokan-ui/dist/dokan-ui.css"; // Make sure to uncomment it if you use Dokan UI in you components

```

## Create the component that you want to show when visit your specific route.
⚠️ Make sure you import your `tailwind.scss` here.
```jsx
import './tailwind.scss';
function Component(props) {
return (
<div className="bg-gradient-to-r from-red-600 via-green-500 to-yellow-600 inline-block text-transparent bg-clip-text">This is my component body...</div>
);
}

export default Component;
```

## Register your `route` and `router component`
Navigate to `dokan-lite/src/Routing/index.tsx` and push your route and component before the `dokan-frontend-routes` apply filters.
```js
routes.push(
{
id: 'your-page',
title: __( 'Your page heading...', 'dokan-lite' ),
element: <Component/>,
path: 'your-page',
exact: true,
order: 10,
parent: '',
}
);
```

## Color Customizer support for components

## Dokan Specific Color
```text
dokan-sidebar
dokan-sidebar-hover
dokan-btn
dokan-btn-hover
```
## Color usecase
The usage of the color name for the background `.bg-dokan-btn` will use `--dokan-button-background-color` variable and other use of the color name such as `.text-dokan-btn` or `.border-dokan-btn` will take the correct color from the variable.
Loading