Skip to content

Commit

Permalink
feat: initial build
Browse files Browse the repository at this point in the history
  • Loading branch information
HinsonSIDAN committed Jan 14, 2024
1 parent 9ac0c9d commit ffafadd
Show file tree
Hide file tree
Showing 39 changed files with 4,192 additions and 0 deletions.
36 changes: 36 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
{
"env": {
"es2021": true,
"node": true
},
"extends": [
"airbnb-base",
"eslint:recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"plugin:@typescript-eslint/recommended",
"prettier"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 12,
"sourceType": "module"
},
"plugins": ["@typescript-eslint/eslint-plugin", "prettier"],
"rules": {
"import/prefer-default-export": "off",
"@typescript-eslint/no-inferrable-types": "off",
"import/extensions": "off",
"camelcase": "off",
"prettier/prettier": 0,
"no-console": "off"
},
"settings": {
"import/resolver": {
"typescript": {
"alwaysTryTypes": true
}
}
}
}
43 changes: 43 additions & 0 deletions .github/workflows/npm-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages

name: Node.js Package

on:
release:
types: [created]
push:
branches:
- main
pull_request:
branches:
- main

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- run: yarn ci

publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
registry-url: https://registry.npmjs.org/
- run: yarn ci
- run: |
if [[ "${{ github.event.head_commit.message }}" =~ ^(docs:|chore:) ]]; then
echo "Skipping npm publish due to commit message."
else
npm publish --access public
fi
env:
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.env
node_modules
.build
dist
.vscode
4 changes: 4 additions & 0 deletions .husky/commit-msg
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx --no -- commitlint --edit
5 changes: 5 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
yarn lint
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
coverage
7 changes: 7 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"singleQuote": true,
"trailingComma": "all",
"tabWidth": 4,
"semi": true,
"printWidth": 100
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# SIDAN UI

This is the UI library developed by SIDAN Lab for quick development with modern design.
1 change: 1 addition & 0 deletions commitlint.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = { extends: ['@commitlint/config-conventional'] };
62 changes: 62 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"name": "@sidan-lab/sidan-ui",
"description": "UI library from SIDAN Lab",
"version": "0.0.1",
"license": "Apache-2.0",
"main": "dist/cjs/index.js",
"module": "dist/mjs/index.js",
"exports": {
".": {
"import": "./dist/mjs/index.js",
"require": "./dist/cjs/index.js"
}
},
"homepage": "https://github.com/sidan-lab/sidan-ui",
"author": {
"name": "sidan-lab",
"email": "[email protected]"
},
"repository": {
"type": "git",
"url": "https://github.com/sidan-lab/sidan-ui.git"
},
"files": [
"dist"
],
"keywords": [
"react",
"stitches",
"ui"
],
"scripts": {
"pub": "yarn ci && npm publish --access public",
"lint": "eslint 'src/*.ts' --fix",
"prepare": "husky install"
},
"dependencies": {
"@stitches/react": "^1.2.8",
"eslint": "8.35.0",
"eslint-config-next": "13.2.3",
"typescript": "4.9.5"
},
"lint-staged": {
"**/*.{js,ts,}": [
"yarn prettier --write",
"yarn eslint --fix"
]
},
"devDependencies": {
"@types/node": "18.14.6",
"@commitlint/cli": "^17.4.3",
"@commitlint/config-conventional": "^17.4.3",
"@typescript-eslint/eslint-plugin": "^5.52.0",
"commitlint": "^17.4.3",
"eslint-config-prettier": "^8.6.0",
"eslint-config-airbnb-base": "^15.0.0",
"eslint-import-resolver-typescript": "^3.6.0",
"eslint-plugin-import": "^2.27.5",
"eslint-plugin-prettier": "^4.2.1",
"husky": "^8.0.3",
"prettier": "^2.8.4"
}
}
55 changes: 55 additions & 0 deletions src/atoms/button.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { styled } from '../styles';

export const Button = styled('button', {
display: 'flex',
pos: 'relative',
p: ['8px 20px'],
// bg: '$bgPrimary',
rounded: '$button',
fontFamily: '$primary',
gradient: '$primary',
justifyContent: 'center',
cursor: 'pointer',
borderStyle: 'none',
'&:hover': {
boxShadow: '$lg',
opacity: '$hover',
},
variants: {
style: {
primary: {
color: '$white',
gradient: '$gradient-primary-button',
},
secondary: {
color: '$textOnSecondary',
gradient: '$gradient-secondary-button',
},
'action-primary': {
p: ['4px 16px'],
color: '$white',
gradient: '$gradient-primary-button',
rounded: '$button-action',
border: '1px solid $primary',
},
'action-secondary': {
p: ['4px 16px'],
color: '$textSecondary',
bg: '$white',
rounded: '$button-action',
border: '1px solid $primary',
},
},
size: {
sm: {
p: ['6px 10px'],
},
md: {
p: ['8px 20px'],
},
lg: {
p: ['15px 25px'],
},
},
},
});
Empty file added src/atoms/card.ts
Empty file.
1 change: 1 addition & 0 deletions src/atoms/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './button';
Empty file added src/atoms/input.ts
Empty file.
Empty file added src/atoms/text.ts
Empty file.
1 change: 1 addition & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './atoms';
Empty file added src/molecules/index.ts
Empty file.
Empty file added src/molecules/loading.ts
Empty file.
7 changes: 7 additions & 0 deletions src/styles/animations.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import { keyframes } from '@stitches/react';

const spinning = keyframes({
'0%': { transform: 'rotate(0deg)' },
'100%': { transform: 'rotate(360deg)' },
});
export { spinning };
2 changes: 2 additions & 0 deletions src/styles/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './tokens';
export * from './stitches.config';
73 changes: 73 additions & 0 deletions src/styles/stitches.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import type * as Stitches from '@stitches/react';
import { createStitches, defaultThemeMap } from '@stitches/react';
import {
ThemeTypes,
backgroundImages,
borderRadius,
colors,
filters,
fonts,
medias,
opacities,
shadows,
sizes,
spacings,
transitions,
utils,
zIndices,
} from './tokens';

export const NAVBAR_HEIGHT = '130px';
export const NAVBAR_MOBILE_HEIGHT = '89px';
export const {
config,
createTheme,
css,
getCssText,
globalCss,
styled,
theme: stitchesTheme,
keyframes,
} = createStitches({
themeMap: {
...defaultThemeMap,
opacity: 'opacities',
backgroundImage: 'backgroundImage',
borderStyle: 'borderStyle',
},
theme: {
borderStyles: {},
borderWidths: {},
colors: { ...colors.light },
fonts: { ...fonts.families },
fontSizes: { ...fonts.sizes },
fontWeights: { ...fonts.weights },
letterSpacings: { ...fonts.letterSpacings },
lineHeights: { ...fonts.lineHeights },
radii: { ...borderRadius },
shadows: { ...shadows },
sizes: { ...sizes },
space: { ...spacings },
transitions: { ...transitions },
opacities: { ...opacities },
zIndices: { ...zIndices },
filters: { ...filters },
backgroundImage: { ...backgroundImages },
},
utils: { ...utils },
media: { ...medias },
});

export type CreateThemeProps = ReturnType<typeof createTheme>;
export type StitchesConfigProps = Stitches.CSS<typeof config>;

export const theme: {
[key in ThemeTypes]: CreateThemeProps;
} = {
dark: createTheme({
colors: colors.dark,
}),
light: createTheme({
colors: colors.light,
}),
};
Loading

0 comments on commit ffafadd

Please sign in to comment.