Skip to content

Commit

Permalink
feat(docs): 📝 docs setup added
Browse files Browse the repository at this point in the history
  • Loading branch information
samavati committed Apr 26, 2024
1 parent 40d807b commit d7a3b70
Show file tree
Hide file tree
Showing 16 changed files with 15,637 additions and 6,738 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,7 @@ testem.log
Thumbs.db

.nx/cache

# Next.js
.next
out
25 changes: 25 additions & 0 deletions docs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"extends": [
"plugin:@nx/react-typescript",
"next",
"next/core-web-vitals",
"../.eslintrc.base.json"
],
"ignorePatterns": ["!**/*", ".next/**/*"],
"overrides": [
{
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
"rules": {
"@next/next/no-html-link-for-pages": ["error", "docs/pages"]
}
},
{
"files": ["*.ts", "*.tsx"],
"rules": {}
},
{
"files": ["*.js", "*.jsx"],
"rules": {}
}
]
}
6 changes: 6 additions & 0 deletions docs/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/* eslint-disable @typescript-eslint/no-explicit-any */
declare module '*.svg' {
const content: any;
export const ReactComponent: any;
export default content;
}
5 changes: 5 additions & 0 deletions docs/next-env.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />

// NOTE: This file should not be edited
// see https://nextjs.org/docs/basic-features/typescript for more information.
40 changes: 40 additions & 0 deletions docs/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
//@ts-check

/**
* we need this to fix the issue with integrating the nx with nextra
*/
if (process.cwd() !== __dirname) {
process.chdir(__dirname);
}

// eslint-disable-next-line @typescript-eslint/no-var-requires
const { composePlugins, withNx } = require('@nx/next');
// eslint-disable-next-line @typescript-eslint/no-var-requires
const nextra = require('nextra');

/**
* @type {import('@nx/next/plugins/with-nx').WithNxOptions}
**/
const nextConfig = {
nx: {
// Set this to true if you would like to use SVGR
// See: https://github.com/gregberge/svgr
svgr: false,
},
};

// @ts-ignore
const withNextra = nextra({
theme: 'nextra-theme-docs',
themeConfig: './theme.config.tsx',
});

const plugins = [
// Add more Next.js plugins to this list if needed.
withNx,
withNextra,
];

const composed = composePlugins(...plugins)(nextConfig);

module.exports = composed;
15 changes: 15 additions & 0 deletions docs/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
const { join } = require('path');

// Note: If you use library-specific PostCSS/Tailwind configuration then you should remove the `postcssConfig` build
// option from your application's configuration (i.e. project.json).
//
// See: https://nx.dev/guides/using-tailwind-css-in-react#step-4:-applying-configuration-to-libraries

module.exports = {
plugins: {
tailwindcss: {
config: join(__dirname, 'tailwind.config.js'),
},
autoprefixer: {},
},
};
9 changes: 9 additions & 0 deletions docs/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "docs",
"$schema": "../node_modules/nx/schemas/project-schema.json",
"sourceRoot": "docs",
"projectType": "application",
"tags": [],
"// targets": "to see all targets run: nx show project docs --web",
"targets": {}
}
Empty file added docs/public/.gitkeep
Empty file.
Binary file added docs/public/favicon.ico
Binary file not shown.
44 changes: 44 additions & 0 deletions docs/src/pages/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

# Swiperia

Swiperia is a powerful and flexible library for creating smooth and responsive swiping experiences in web applications. Whether you're building a carousel, a touch-enabled slider, or any other interactive UI component that requires swiping gestures, Swiperia has got you covered.

## Features

- **Cross-Platform Support**: Swiperia works seamlessly across different platforms and devices, including desktops, tablets, and mobile phones.
- **Customizable Swiping Behavior**: Customize the swiping behavior to fit your specific needs, such as setting thresholds, defining swipe directions, and handling different swipe events.
- **Extensible and Modular**: Swiperia is designed with extensibility in mind, allowing you to create and integrate custom swiping behaviors or plugins.
- **Performant and Lightweight**: Swiperia is built with performance as a top priority, ensuring smooth and efficient swiping experiences even on resource-constrained devices.
- **Accessible and Inclusive**: Swiperia follows best practices for accessibility, ensuring that your swiping components are usable by everyone, including users with disabilities.

## Getting Started

To get started with Swiperia, you can install it via npm or yarn:

```bash
npm install swiperia
# or
yarn add swiperia
```


Once installed, you can import and use the Swiperia components in your application:

```bash
import { Swiper, MouseSwiper, TouchSwiper } from 'swiperia';

const mySwiper = new Swiper(targetElement, [MouseSwiper, TouchSwiper]);

mySwiper.listen((event) => {
// Handle swipe events
});
```
## Documentation
For detailed documentation, including guides, API references, and examples, please visit the Swiperia Documentation.
## Contributing
We welcome contributions from the community! If you'd like to contribute to Swiperia, please read our Contributing Guide for more information.
## License
Swiperia is released under the MIT License.
17 changes: 17 additions & 0 deletions docs/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
const { createGlobPatternsForDependencies } = require('@nx/react/tailwind');
const { join } = require('path');

/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
join(
__dirname,
'{src,pages,components,app}/**/*!(*.stories|*.spec).{ts,tsx,html}'
),
...createGlobPatternsForDependencies(__dirname),
],
theme: {
extend: {},
},
plugins: [],
};
12 changes: 12 additions & 0 deletions docs/theme.config.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { type ThemeConfig } from 'nextra';

const config: ThemeConfig = {
logo: <span>Swiperia</span>,
project: {
link: 'https://github.com/samavati/swiperia',

},
};

export default config;

37 changes: 37 additions & 0 deletions docs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"extends": "../tsconfig.base.json",
"compilerOptions": {
"jsx": "preserve",
"allowJs": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"resolveJsonModule": true,
"isolatedModules": true,
"incremental": true,
"plugins": [
{
"name": "next"
}
]
},
"include": [
"**/*.ts",
"**/*.tsx",
"**/*.js",
"**/*.jsx",
"../docs/.next/types/**/*.ts",
"../dist/docs/.next/types/**/*.ts",
"next-env.d.ts",
"next.config.js",
".next/types/**/*.ts"
],
"exclude": [
"node_modules",
"jest.config.ts",
"**/*.spec.ts",
"**/*.test.ts"
]
}
15 changes: 15 additions & 0 deletions nx.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,15 @@
"options": {
"targetName": "e2e"
}
},
{
"plugin": "@nx/next/plugin",
"options": {
"buildTargetName": "build",
"devTargetName": "dev",
"startTargetName": "start",
"serveStaticTargetName": "serve-static"
}
}
],
"generators": {
Expand All @@ -69,6 +78,12 @@
"linter": "eslint",
"unitTestRunner": "vitest"
}
},
"@nx/next": {
"application": {
"style": "tailwind",
"linter": "eslint"
}
}
}
}
Loading

0 comments on commit d7a3b70

Please sign in to comment.