@mbao01/next 0.0.1 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,36 +1,45 @@
1
- This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).
2
1
 
3
- ## Getting Started
2
+ So here it is, I have gotten really bored creating UI component from scratch for the many projects I work on.
3
+ It is high time I have a unified component library - so here it is.
4
+ I have built this to be highly opinionated on certain libraries I love to use like typescript, tailwind, date-fns, next, and react.
4
5
 
5
- First, run the development server:
6
+ I believe in future this UI component library may extend to meta frameworks, [Remix](https://remix.run/) and even [Nuxt](https://nuxt.com/) (and naturally [Vue.js](https://vuejs.org/) as well).
6
7
 
7
- ```bash
8
- npm run dev
9
- # or
10
- yarn dev
11
- # or
12
- pnpm dev
13
- # or
14
- bun dev
15
- ```
16
8
 
17
- Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.
9
+ # Description
18
10
 
19
- You can start editing the page by modifying `app/page.tsx`. The page auto-updates as you edit the file.
11
+ The library is written using [Next.js](https://nextjs.org/), [Tailwind](https://tailwindcss.com/) and [Typescript](https://www.typescriptlang.org/). The library is uncooked which means there is no build step involved which means you'd have to cater for building the components into your library.
20
12
 
21
- This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.
13
+ # Consuming the library
22
14
 
23
- ## Learn More
15
+ 1. Ensure you have react and typescript install and setup in your project.
16
+ Then install the library
24
17
 
25
- To learn more about Next.js, take a look at the following resources:
26
-
27
- - [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
28
- - [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.
18
+ ```bash
19
+ pnpm add @mbao01/next
20
+ ```
29
21
 
30
- You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!
22
+ or
31
23
 
32
- ## Deploy on Vercel
24
+ ```bash
25
+ npm install @mbao01/next
26
+ ```
33
27
 
34
- The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.
28
+ 2. Install tailwind - do so by following the [installation guide](https://tailwindcss.com/docs/installation)
29
+
30
+ 3. Configure tailwind
31
+
32
+ ```typescript
33
+ export default {
34
+ content: [
35
+ "node_modules/@mbao01/(common|next)/src/**/*", // -> ensure to add this to allow tailwind to scan the library for classes
36
+ ...
37
+ ],
38
+ "plugins": [
39
+ require("@mbao01/common/plugin"), // -> import the tailwind library plugin
40
+ ...
41
+ ]
42
+ }
43
+ ```
35
44
 
36
- Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
45
+ You can also import styles directly from `@mbao01/common/styles`. Use this in-place of `tailwind.css` if you wish.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mbao01/next",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "private": false,
5
5
  "type": "module",
6
6
  "author": "Ayomide Bakare",
@@ -17,8 +17,6 @@
17
17
  "types": "dist/types/index.d.ts",
18
18
  "files": [
19
19
  "src",
20
- "plugin.js",
21
- "plugin.d.ts",
22
20
  "dist/types"
23
21
  ],
24
22
  "bugs": "https://github.com/mbao01/mbao01/issues",
@@ -30,13 +28,24 @@
30
28
  "sideEffects": [
31
29
  "*.css"
32
30
  ],
31
+ "scripts": {
32
+ "dev": "storybook dev -p 6006",
33
+ "build": "next build",
34
+ "build-storybook": "storybook build -o ../../docs/storybook/next",
35
+ "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
36
+ "preview": "next dev",
37
+ "start": "next start",
38
+ "test": "vitest run",
39
+ "test:ui": "vitest --ui",
40
+ "test:watch": "vitest",
41
+ "test:coverage": "vitest run --coverage"
42
+ },
33
43
  "dependencies": {
34
- "clsx": "^2.1.0",
35
- "daisyui": "^4.6.2",
36
- "@mbao01/common": "^0.0.1"
44
+ "@heroicons/react": "^2.1.1",
45
+ "@mbao01/common": "^0.0.3",
46
+ "clsx": "^2.1.0"
37
47
  },
38
48
  "devDependencies": {
39
- "@heroicons/react": "^2.1.1",
40
49
  "@storybook/addon-essentials": "^7.6.14",
41
50
  "@storybook/addon-interactions": "^7.6.14",
42
51
  "@storybook/addon-links": "^7.6.14",
@@ -80,22 +89,7 @@
80
89
  "vitest": "^1.2.2"
81
90
  },
82
91
  "peerDependencies": {
83
- "@heroicons/react": "^2.1.1",
84
- "next": "^14.1.0",
85
- "react": "^18.2.0",
86
- "react-dom": "^18.2.0",
87
- "typescript": "^5.2.2"
92
+ "next": "^14.1.0"
88
93
  },
89
- "scripts": {
90
- "dev": "storybook dev -p 6006",
91
- "build": "next build",
92
- "build-storybook": "storybook build",
93
- "lint": "eslint . --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
94
- "preview": "next dev",
95
- "start": "next start",
96
- "test": "vitest run",
97
- "test:ui": "vitest --ui",
98
- "test:watch": "vitest",
99
- "test:coverage": "vitest run --coverage"
100
- }
101
- }
94
+ "gitHead": "fb1542aac0eb979dd16d8d4448e4380726e4e330"
95
+ }
@@ -1,6 +1,6 @@
1
1
  import type { Metadata } from "next";
2
2
  import { Inter } from "next/font/google";
3
- import "../tailwind.css";
3
+ import "@mbao01/common/styles";
4
4
 
5
5
  const inter = Inter({ subsets: ["latin"] });
6
6
 
package/src/index.ts CHANGED
@@ -1 +1 @@
1
- export * from "./components/Badge";
1
+ export * from "@mbao01/common";
package/plugin.d.ts DELETED
@@ -1,4 +0,0 @@
1
- import type { Config } from "tailwindcss";
2
-
3
- declare const plugin: { handler: () => void; config?: Config };
4
- export = plugin;
package/plugin.js DELETED
@@ -1,3 +0,0 @@
1
- const daisyui = require("daisyui");
2
-
3
- module.exports = daisyui;
@@ -1,29 +0,0 @@
1
- import c from "clsx";
2
- import { getBadgeClasses } from "./constants";
3
- import { type BadgeProps } from "./types";
4
- import "../../tailwind.css"; // replace with the name of your tailwind css file
5
-
6
- export const Badge = ({
7
- size,
8
- outline,
9
- variant = "ghost",
10
- children,
11
- className,
12
- ...props
13
- }: BadgeProps) => {
14
- return (
15
- <span
16
- {...props}
17
- className={c(
18
- getBadgeClasses({ size, variant }),
19
- {
20
- "badge-outline": outline,
21
- "text-base-200": !["ghost", "neutral"].includes(variant),
22
- },
23
- className
24
- )}
25
- >
26
- {children}
27
- </span>
28
- );
29
- };
@@ -1,31 +0,0 @@
1
- import c from "clsx";
2
- import type { BadgeSize, BadgeVariant } from "./types";
3
-
4
- const BADGE_SIZE = {
5
- xs: c("badge-xs"),
6
- sm: c("badge-sm"),
7
- md: c("badge-md"),
8
- lg: c("badge-lg"),
9
- } satisfies Record<BadgeSize, string>;
10
-
11
- const BADGE_VARIANTS = {
12
- accent: c("badge-accent"),
13
- error: c("badge-error"),
14
- ghost: c("badge-ghost"),
15
- info: c("badge-info"),
16
- neutral: c("badge-neutral"),
17
- primary: c("badge-primary"),
18
- secondary: c("badge-secondary"),
19
- success: c("badge-success"),
20
- warning: c("badge-warning"),
21
- } satisfies Record<BadgeVariant, string>;
22
-
23
- export const getBadgeClasses = ({
24
- size,
25
- variant,
26
- }: {
27
- size?: BadgeSize;
28
- variant?: BadgeVariant;
29
- }) => {
30
- return c("badge", BADGE_VARIANTS[variant!], BADGE_SIZE[size!]);
31
- };
@@ -1 +0,0 @@
1
- export { Badge } from './Badge';
@@ -1,18 +0,0 @@
1
- export type BadgeSize = "xs" | "sm" | "md" | "lg";
2
-
3
- export type BadgeVariant =
4
- | "neutral"
5
- | "primary"
6
- | "secondary"
7
- | "accent"
8
- | "ghost"
9
- | "info"
10
- | "success"
11
- | "warning"
12
- | "error";
13
-
14
- export type BadgeProps = React.HTMLAttributes<HTMLSpanElement> & {
15
- size?: BadgeSize;
16
- outline?: boolean;
17
- variant?: BadgeVariant;
18
- };