Skip to content

Commit

Permalink
feat: add css frame work and pushlish css frame work
Browse files Browse the repository at this point in the history
  • Loading branch information
khoilen committed Dec 4, 2024
1 parent 9ac1145 commit af29c2b
Show file tree
Hide file tree
Showing 20 changed files with 1,185 additions and 434 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: "CodeQL Advanced"

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
schedule:
- cron: '18 11 * * 3'

jobs:
analyze:
name: Analyze (${{ matrix.language }})
runs-on: ${{ (matrix.language == 'swift' && 'macos-latest') || 'ubuntu-latest' }}
permissions:
security-events: write

packages: read

actions: read
contents: read

strategy:
fail-fast: false
matrix:
include:
- language: javascript-typescript
build-mode: none

steps:
- name: Checkout repository
uses: actions/checkout@v4

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
build-mode: ${{ matrix.build-mode }}

- if: matrix.build-mode == 'manual'
shell: bash
run: |
echo 'If you are using a "manual" build mode for one or more of the' \
'languages you are analyzing, replace this with the commands to build' \
'your code, for example:'
echo ' make bootstrap'
echo ' make release'
exit 1
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
28 changes: 28 additions & 0 deletions .github/workflows/publish-nt-css.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: Build and Publish CSS Framework

on:
push:
branches:
- main

jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20
- name: Install dependencies
run: npm install
working-directory: apps/nt-css
- name: Build CSS framework
run: npm run build:css
working-directory: apps/nt-css
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_ACCESS_TOKEN }}
working-directory: apps/nt-css
35 changes: 18 additions & 17 deletions .vscode/extensions.json
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
{
"recommendations": [
"editorconfig.editorconfig",
"streetsidesoftware.code-spell-checker",
"formulahendry.auto-close-tag",
"dbaeumer.vscode-eslint",
"lwlz.autofix",
"pkief.material-icon-theme",
"davidanson.vscode-markdownlint",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
"dbaeumer.vscode-eslint",
"davidanson.vscode-markdownlint",
"ambar.bundle-size",
"yoavbls.pretty-ts-errors",
"csstools.postcss"
]
"recommendations": [
"sainoba.px-to-rem",
"editorconfig.editorconfig",
"streetsidesoftware.code-spell-checker",
"formulahendry.auto-close-tag",
"dbaeumer.vscode-eslint",
"lwlz.autofix",
"pkief.material-icon-theme",
"davidanson.vscode-markdownlint",
"eamodio.gitlens",
"esbenp.prettier-vscode",
"bradlc.vscode-tailwindcss",
"dbaeumer.vscode-eslint",
"davidanson.vscode-markdownlint",
"ambar.bundle-size",
"yoavbls.pretty-ts-errors",
"csstools.postcss"
]
}
5 changes: 4 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
{
"css.customData": [".vscode/tailwind.json"],
"[typescript]": {
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"editor.codeActionsOnSave": {
"source.fixAll": "always"
}
},
"files.associations": {
"*.css": "tailwindcss",
"*.scss": "tailwindcss"
}
}
82 changes: 41 additions & 41 deletions apps/base-ui-toolkit-react/project.json
Original file line number Diff line number Diff line change
@@ -1,45 +1,45 @@
{
"targets": {
"typecheck": {
"executor": "nx:run-commands",
"options": {
"commands": ["tsc -p tsconfig.app.json --noEmit"],
"cwd": "apps/base-ui-toolkit-react",
"forwardAllArgs": false
}
}
},
"test": {
"executor": "@nrwl/vite:test",
"outputs": ["coverage/apps/base-ui-toolkit-react"],
"options": {
"passWithNoTests": true,
"reportsDirectory": "../../coverage/apps/sample-react-app"
}
},
"build": {
"executor": "@nrwl/vite:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/apps/base-ui-toolkit-react"
"targets": {
"typecheck": {
"executor": "nx:run-commands",
"options": {
"commands": ["tsc -p tsconfig.app.json --noEmit"],
"cwd": "apps/base-ui-toolkit-react",
"forwardAllArgs": false
}
}
},
"configurations": {
"development": {
"mode": "development"
},
"production": {
"mode": "production"
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"apps/base-ui-toolkit-react/**/*.{ts,tsx,js,jsx}"
]
"test": {
"executor": "@nrwl/vite:test",
"outputs": ["coverage/apps/base-ui-toolkit-react"],
"options": {
"passWithNoTests": true,
"reportsDirectory": "../../coverage/apps/sample-react-app"
}
},
"build": {
"executor": "@nrwl/vite:build",
"outputs": ["{options.outputPath}"],
"defaultConfiguration": "production",
"options": {
"outputPath": "dist/apps/base-ui-toolkit-react"
},
"configurations": {
"development": {
"mode": "development"
},
"production": {
"mode": "production"
}
}
},
"lint": {
"executor": "@nrwl/linter:eslint",
"outputs": ["{options.outputFile}"],
"options": {
"lintFilePatterns": [
"apps/base-ui-toolkit-react/**/*.{ts,tsx,js,jsx}"
]
}
}
}
}
31 changes: 11 additions & 20 deletions apps/base-ui-toolkit-react/src/utils/theme.ts
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
export const isPrimaryTheme = (theme: string) => {
return theme === 'primary'
}
export const isPrimaryTheme = (theme: string) => theme === 'primary'

export const getBorderTheme = (theme: string) => {
return isPrimaryTheme(theme) ? 'border-primary' : 'border-success'
}
export const getBorderTheme = (theme: string) =>
isPrimaryTheme(theme) ? 'border-primary' : 'border-success'

export const getShadowTheme = (theme: string) => {
return isPrimaryTheme(theme) ? 'shadow-primary' : 'shadow-success'
}
export const getShadowTheme = (theme: string) =>
isPrimaryTheme(theme) ? 'shadow-primary' : 'shadow-success'

export const getBgTheme = (theme: string) => {
return isPrimaryTheme(theme) ? 'bg-primary' : 'bg-success'
}
export const getBgTheme = (theme: string) =>
isPrimaryTheme(theme) ? 'bg-primary' : 'bg-success'

export const getHoverBorder = (theme: string) => {
return isPrimaryTheme(theme)
export const getHoverBorder = (theme: string) =>
isPrimaryTheme(theme)
? 'hover:border-primary'
: 'hover:border-success'
}

export const getActiveBgWithTheme = (theme: string) => {
return isPrimaryTheme(theme)
? 'active:bg-primary'
: 'active:bg-success'
}
export const getActiveBgWithTheme = (theme: string) =>
isPrimaryTheme(theme) ? 'active:bg-primary' : 'active:bg-success'
79 changes: 79 additions & 0 deletions apps/nt-css/Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# nt-css

## Overview

**nt-css** is a lightweight, customizable CSS framework designed to simplify the process of styling your web projects. It leverages the power of Tailwind CSS to provide a robust set of utility classes, enabling you to build responsive and modern UIs with ease.

## Features

- Simple to use
- Customizable with utility classes
- Lightweight and fast
- Responsive design support
- Integration with Tailwind CSS

## Installation

You can install **nt-css** via npm or pnpm.

### Using npm

```sh
npm install nt-css
```

### Usage

To use nt-css in your project, include the generated `styles.css` file in the `<head>` section of your HTML file.

```html
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta
name="viewport"
content="width=device-width, initial-scale=1.0"
/>
<link
href="node_modules/nt-css/dist/styles.css"
rel="stylesheet"
/>
<title>Example</title>
</head>
<body>
<h1 class="text-3xl font-bold underline">Hello, nt-css!</h1>
</body>
</html>
```

### Customization

You can customize nt-css by editing the `tailwind.config.js` file. Add your own styles or override existing ones to fit your design needs.

```css
@import 'nt-css/dist/styles.css';
@tailwind base;
@tailwind components;
@tailwind utilities;
```

```js
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ['./src/**/*.{html,js}'],
theme: {
extend: {
colors: {
primary: '#ff6347',
secondary: '#4b5563',
},
},
},
plugins: [],
}
```

### Acknowledgements

`nt-css` is built upon the powerful Tailwind CSS framework, making it easy to use and customize. We extend our gratitude to the Tailwind CSS community for their continuous support and contributions.
23 changes: 23 additions & 0 deletions apps/nt-css/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"name": "nt-css",
"version": "1.0.0",
"description": "",
"packageManager": "[email protected]",
"scripts": {
"build:css": "pnpm exec postcss src/styles.scss -o dist/styles.css",
"publish:css": "pnpm run build:css && npm publish dist/apps/nt-css"
},
"engines": {
"node": "20"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "20.4.9",
"autoprefixer": "^10.4.20",
"postcss": "^8.4.49",
"tailwindcss": "^3.4.0",
"typescript": "^5.6.3"
}
}
8 changes: 8 additions & 0 deletions apps/nt-css/postcss.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
module.exports = {
plugins: {
'postcss-import': {},
'tailwindcss/nesting': 'postcss-nesting',
tailwindcss: {},
autoprefixer: {},
},
}
13 changes: 13 additions & 0 deletions apps/nt-css/project.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"name": "nt-css",
"targets": {
"build": {
"executor": "@nrwl/node:build",
"outputs": ["{options.outputPath}"],
"options": {
"outputPath": "dist/apps/nt-css",
"assets": ["src/**/*"]
}
}
}
}
Loading

0 comments on commit af29c2b

Please sign in to comment.