Skip to content

Commit

Permalink
add new sample: react shadcn dashboard
Browse files Browse the repository at this point in the history
  • Loading branch information
Sandeep-FED committed Nov 10, 2024
1 parent f55ceba commit cac2dba
Show file tree
Hide file tree
Showing 44 changed files with 31,073 additions and 0 deletions.
352 changes: 352 additions & 0 deletions samples/react-shadcn-dashboard/.eslintrc.js

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions samples/react-shadcn-dashboard/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Logs
logs
*.log
npm-debug.log*

# Dependency directories
node_modules

# Build generated files
dist
lib
release
solution
temp
*.sppkg
.heft

# Coverage directory used by tools like istanbul
coverage

# OSX
.DS_Store

# Visual Studio files
.ntvs_analysis.dat
.vs
bin
obj

# Resx Generated Code
*.resx.ts

# Styles Generated Code
*.scss.ts
16 changes: 16 additions & 0 deletions samples/react-shadcn-dashboard/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
!dist
config

gulpfile.js

release
src
temp

tsconfig.json
tslint.json

*.log

.yo-rc.json
.vscode
24 changes: 24 additions & 0 deletions samples/react-shadcn-dashboard/.yo-rc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"@microsoft/generator-sharepoint": {
"whichFolder": "subdir",
"solutionName": "react-chakra-ui",
"componentType": "webpart",
"template": "react",
"componentName": "react-chakra-ui",
"plusBeta": false,
"isCreatingSolution": true,
"nodeVersion": "18.18.2",
"sdksVersions": {
"@microsoft/microsoft-graph-client": "3.0.2",
"@microsoft/teams-js": "2.12.0"
},
"version": "1.19.0",
"libraryName": "react-chakra-ui",
"libraryId": "c12856f1-6713-43f2-9cbc-1a0c4186d57c",
"environment": "spo",
"packageManager": "npm",
"solutionShortDescription": "react-chakra-ui description",
"skipFeatureDeployment": true,
"isDomainIsolated": false
}
}
89 changes: 89 additions & 0 deletions samples/react-shadcn-dashboard/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
# React ShadCN Dashboard

## Summary

This SharePoint Framework (SPFx) web part serves as a foundational solution for developers aiming to use ShadCN components within SPFx projects. By integrating ShadCN components with Tailwind CSS in an SPFx web part, this project enables developers to craft modern, responsive, and visually appealing SharePoint webparts. This solution provides a seamless, intuitive developer experience for building advanced UI elements in SharePoint.

![Dashboard Screenshot](./assets//Screenshot%202024-11-09%20at%2020.21.27.png)

## Compatibility

| :warning: Important |
| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Every SPFx version is optimally compatible with specific versions of Node.js. To build this sample, ensure that the version of Node on your workstation matches one of the versions listed in this section. |
| Refer to <https://aka.ms/spfx-matrix> for more information on SPFx compatibility. |

## Used SharePoint Framework Version

![version](https://img.shields.io/badge/version-1.19.0-green.svg)

This sample is optimized for the following environment configuration:

![SPFx 1.19.0](https://img.shields.io/badge/SPFx-1.19.0-green.svg)
![Node.js v18 | v16](https://img.shields.io/badge/Node.js-v18%20%7C%20v16-green.svg)
![Compatible with SharePoint Online](https://img.shields.io/badge/SharePoint%20Online-Compatible-green.svg)

## Applies to

- [SharePoint Framework](https://aka.ms/spfx)
- [Microsoft 365 tenant](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)

> Get your own free development tenant by subscribing to [Microsoft 365 developer program](http://aka.ms/o365devprogram)
## Solution

| Solution | Author(s) |
| ------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| react-shadcn-dashboard | Sandeep P S ( [LinkedIn](https://www.linkedin.com/in/sandeepps1299/) ) / Quadrasystems.net ( [Twitter](https://www.linkedin.com/company/quadrasystems.net-india-pvt-ltd) / [LinkedIn](https://www.linkedin.com/company/quadrasystems.net-india-pvt-ltd) ) |

## Contributors🧑‍💻

- [Sandeep P S](https://github.com/Sandeep-FED)

## Version history

| Version | Date | Comments |
| ------- | ---------------- | --------------------------------------- |
| 1.0 | November 9, 2024 | Initial release with ShadCN and Tailwind CSS integration |

## Features💡

Key features demonstrated by this solution:

- Enables ShadCN component integration within SPFx projects
- Utilizes Tailwind CSS for efficient, responsive styling
- Empowers developers to create modern, modular, and user-friendly webparts in SharePoint

## Minimal Path to Awesome⚡

- Clone this repository
- Ensure that you are in the solution folder
- Run these commands:
- `npm install`
- `gulp serve`

## Deploy Package Solution 🚀

- Ensure that you are in the solution folder
- Run these commands:
- `gulp build --ship`
- `gulp bundle --ship`
- `gulp package-solution --ship`
- Upload the package to the AppCatalog and add it to your SharePoint site.

## References

- [ShadCN Library](https://shadcn.dev) - Powerful UI components for modern web apps.
- [Tailwind CSS](https://tailwindcss.com) - Utility-first CSS framework for rapid UI development.
- [Microsoft 365 Patterns and Practices](https://aka.ms/m365pnp)
- [SharePoint Framework](https://docs.microsoft.com/en-us/sharepoint/dev/spfx/set-up-your-developer-tenant)

## Help

The community is always willing to help improve these samples. If you're having issues building the solution, run [spfx doctor](https://pnp.github.io/cli-microsoft365/cmd/spfx/spfx-doctor/) from within the solution folder to check compatibility.

If you encounter issues, [create a new issue](https://github.com/pnp/sp-dev-fx-webparts/issues/new). For questions or improvement ideas, the same link will guide you to the community space for assistance.

## Disclaimer

**THIS CODE IS PROVIDED _AS IS_ WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED.**
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
76 changes: 76 additions & 0 deletions samples/react-shadcn-dashboard/assets/tailwind.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
@tailwind base;
@tailwind components;
@tailwind utilities;

@layer base {
:root {
--background: 0 0% 100%;
--foreground: 224 71.4% 4.1%;

--card: 0 0% 100%;
--card-foreground: 224 71.4% 4.1%;

--popover: 0 0% 100%;
--popover-foreground: 224 71.4% 4.1%;

--primary: 220.9 39.3% 11%;
--primary-foreground: 210 20% 98%;

--secondary: 220 14.3% 95.9%;
--secondary-foreground: 220.9 39.3% 11%;

--muted: 220 14.3% 95.9%;
--muted-foreground: 220 8.9% 46.1%;

--accent: 220 14.3% 95.9%;
--accent-foreground: 220.9 39.3% 11%;

--destructive: 0 84.2% 60.2%;
--destructive-foreground: 210 20% 98%;

--border: 220 13% 91%;
--input: 220 13% 91%;
--ring: 224 71.4% 4.1%;

--radius: 0.5rem;
}

.dark {
--background: 224 71.4% 4.1%;
--foreground: 210 20% 98%;

--card: 224 71.4% 4.1%;
--card-foreground: 210 20% 98%;

--popover: 224 71.4% 4.1%;
--popover-foreground: 210 20% 98%;

--primary: 210 20% 98%;
--primary-foreground: 220.9 39.3% 11%;

--secondary: 215 27.9% 16.9%;
--secondary-foreground: 210 20% 98%;

--muted: 215 27.9% 16.9%;
--muted-foreground: 217.9 10.6% 64.9%;

--accent: 215 27.9% 16.9%;
--accent-foreground: 210 20% 98%;

--destructive: 0 62.8% 30.6%;
--destructive-foreground: 210 20% 98%;

--border: 215 27.9% 16.9%;
--input: 215 27.9% 16.9%;
--ring: 216 12.2% 83.9%;
}
}

@layer base {
* {
@apply border-border;
}
body {
@apply bg-background text-foreground;
}
}
17 changes: 17 additions & 0 deletions samples/react-shadcn-dashboard/components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "assets/tailwind.css",
"baseColor": "gray",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "utilties/components",
"utils": "utilties/lib/util"
}
}
18 changes: 18 additions & 0 deletions samples/react-shadcn-dashboard/config/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/config.2.0.schema.json",
"version": "2.0",
"bundles": {
"react-shadcn-ui-web-part": {
"components": [
{
"entrypoint": "./lib/webparts/reactShadCN/reactShadCNWebPart.js",
"manifest": "./src/webparts/reactShadCN/reactShadCNWebPart.manifest.json"
}
]
}
},
"externals": {},
"localizedResources": {
"reactShadCNWebPartStrings": "lib/webparts/reactShadCN/loc/{locale}.js"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/deploy-azure-storage.schema.json",
"workingDir": "./release/assets/",
"account": "<!-- STORAGE ACCOUNT NAME -->",
"container": "react-shadcn-ui",
"accessKey": "<!-- ACCESS KEY -->"
}
40 changes: 40 additions & 0 deletions samples/react-shadcn-dashboard/config/package-solution.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
"solution": {
"name": "react-shadcn-ui-client-side-solution",
"id": "c12856f1-6713-43f2-9cbc-1a0c4186d57c",
"version": "1.0.0.0",
"includeClientSideAssets": true,
"skipFeatureDeployment": true,
"isDomainIsolated": false,
"developer": {
"name": "",
"websiteUrl": "",
"privacyUrl": "",
"termsOfUseUrl": "",
"mpnId": "Undefined-1.19.0"
},
"metadata": {
"shortDescription": {
"default": "react-shadcn-ui description"
},
"longDescription": {
"default": "react-shadcn-ui description"
},
"screenshotPaths": [],
"videoUrl": "",
"categories": []
},
"features": [
{
"title": "react-shadcn-ui Feature",
"description": "The feature that activates elements of the react-shadcn-ui solution.",
"id": "ae831b77-e0f4-44f6-8ab6-8a87f4dcf68c",
"version": "1.0.0.0"
}
]
},
"paths": {
"zippedPackage": "solution/react-shadcn-ui.sppkg"
}
}
3 changes: 3 additions & 0 deletions samples/react-shadcn-dashboard/config/sass.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/core-build/sass.schema.json"
}
6 changes: 6 additions & 0 deletions samples/react-shadcn-dashboard/config/serve.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/spfx-serve.schema.json",
"port": 4321,
"https": true,
"initialPage": "https://{tenantDomain}/_layouts/workbench.aspx"
}
4 changes: 4 additions & 0 deletions samples/react-shadcn-dashboard/config/write-manifests.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"$schema": "https://developer.microsoft.com/json-schemas/spfx-build/write-manifests.schema.json",
"cdnBasePath": "<!-- PATH TO CDN -->"
}
36 changes: 36 additions & 0 deletions samples/react-shadcn-dashboard/gulpfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
"use strict"

const build = require("@microsoft/sp-build-web")
const path = require("path")

build.addSuppression(
`Warning - [sass] The local CSS class 'ms-Grid' is not camelCase and will not be type-safe.`
)

var getTasks = build.rig.getTasks
build.rig.getTasks = function () {
var result = getTasks.call(build.rig)

result.set("serve", result.get("serve-deprecated"))

return result
}

// add task to build tailwind css
const postcss = require("gulp-postcss")
const atimport = require("postcss-import")
const tailwind = require("tailwindcss")

const tailwindcss = build.subTask(
"tailwindcss",
function (gulp, buildOptions, done) {
gulp
.src("assets/tailwind.css")
.pipe(postcss([atimport(), tailwind("./tailwind.config.js")]))
.pipe(gulp.dest("assets/dist"))
done()
}
)
build.rig.addPreBuildTask(tailwindcss)

build.initialize(require("gulp"))
Loading

0 comments on commit cac2dba

Please sign in to comment.