Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
saeedalipoor committed Apr 30, 2024
0 parents commit be2d68f
Show file tree
Hide file tree
Showing 417 changed files with 31,610 additions and 0 deletions.
8 changes: 8 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
root = true

[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = false
insert_final_newline = false
4 changes: 4 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
public/
out/
.next/
79 changes: 79 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
{
"extends": [
"eslint:recommended",
"plugin:react/recommended",
"plugin:import/recommended",
"plugin:import/errors",
"plugin:import/warnings",
"plugin:import/typescript",
"prettier"
],
"env": {
"browser": true,
"es6": true,
"node": true,
"commonjs": true
},
"globals": {
"Atomics": "readonly",
"SharedArrayBuffer": "readonly",
"JSX": true
},
"plugins": [
"eslint-plugin-import",
"eslint-plugin-react",
"eslint-plugin-react-hooks",
"@typescript-eslint/eslint-plugin"
],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"ecmaVersion": 2018,
"sourceType": "module",
"allowImportExportEverywhere": true
},
"rules": {
"no-const-assign": "error",
"no-case-declarations": "warn",
"no-empty-pattern": "error",
"no-fallthrough": "warn",
"no-global-assign": "error",
"no-alert": "error",
"no-with": "error",
"no-delete-var": "error",
"no-shadow-restricted-names": "error",
"no-dupe-class-members": "error",
"no-new-symbol": "error",
"no-this-before-super": "error",
"no-undef": "error",
"no-console": "warn",
"no-octal": "error",
"no-redeclare": "error",
"no-self-assign": "error",
"no-useless-catch": "error",
"no-useless-escape": "warn",
"no-unused-vars": "warn",
"no-mixed-spaces-and-tabs": "warn",
"no-class-assign": "error",
"constructor-super": "error",
"require-yield": "error",
"prefer-const": "error",
"default-case": "warn",
"@typescript-eslint/no-unused-vars": "warn",
"react-hooks/rules-of-hooks": "error",
"react-hooks/exhaustive-deps": "warn",
"react/react-in-jsx-scope": "off",
"react/prop-types": "off",
"react/jsx-no-undef": [2, { "allowGlobals": true }]
},
"settings": {
"react": {
"version": "detect"
},
"import/resolver": {
"node": {
"paths": ["."],
"extensions": [".js", ".jsx", ".ts", ".tsx", ".d.ts"]
}
}
}
}
Empty file.
130 changes: 130 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
# See https://github.com/github/gitignore/blob/master/Node.gitignore

# Logs
logs
*.log
npm-debug.log*
yarn-debug.log*
yarn-error.log*
lerna-debug.log*

# Diagnostic reports (https://nodejs.org/api/report.html)
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json

# Runtime data
pids
*.pid
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
*.lcov

# nyc test coverage
.nyc_output

# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
.grunt

# Bower dependency directory (https://bower.io/)
bower_components

# node-waf configuration
.lock-wscript

# Compiled binary addons (https://nodejs.org/api/addons.html)
build/Release

# Dependency directories
node_modules/
jspm_packages/

# Snowpack dependency directory (https://snowpack.dev/)
web_modules/

# TypeScript cache
*.tsbuildinfo

# Optional npm cache directory
.npm

# Optional eslint cache
.eslintcache

# Microbundle cache
.rpt2_cache/
.rts2_cache_cjs/
.rts2_cache_es/
.rts2_cache_umd/

# Optional REPL history
.node_repl_history

# Output of 'npm pack'
*.tgz

# Yarn Integrity file
.yarn-integrity

# dotenv environment variables file
.env
.env.test
shell.env

# parcel-bundler cache (https://parceljs.org/)
.cache
.parcel-cache

# Next.js build output
.next
out

# Nuxt.js build / generate output
.nuxt
dist

# Gatsby files
.cache/
# Comment in the public line in if your project uses Gatsby and not Next.js
# https://nextjs.org/blog/next-9-1#public-directory-support
# public

# vuepress build output
.vuepress/dist

# Serverless directories
.serverless/

# FuseBox cache
.fusebox/

# DynamoDB Local files
.dynamodb/

# TernJS port file
.tern-port

# Stores VSCode versions used for testing VSCode extensions
.vscode-test

# yarn v2
.yarn/cache
.yarn/unplugged
.yarn/build-state.yml
.pnp.*

# testing
/coverage

# production
/build

# misc
.DS_Store

.idea
.vscode
4 changes: 4 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
node_modules/
public/
out/
.next/
11 changes: 11 additions & 0 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"bracketSpacing": true,
"packageManager": "yarn",
"printWidth": 80,
"semi": true,
"singleQuote": false,
"tabWidth": 2,
"useEditorConfig": true,
"trailingComma": "none",
"arrowParens": "avoid"
}
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Sonnat Design System - Documentation Website
46 changes: 46 additions & 0 deletions components/ActiveLink/ActiveLink.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import createClassName from "classnames";
import Link, { LinkProps as NextLinkProps } from "next/link";
import { useRouter } from "next/router";
import * as React from "react";

export interface ActiveLinkProps extends NextLinkProps {
onActive?: () => void;
activeClassName?: string;
}

const ActiveLink: React.FC<ActiveLinkProps> = props => {
const {
children,
href,
onActive,
activeClassName = "active",
...otherProps
} = props;

const child = React.Children.only(
children
) as NonNullable<React.ReactElement>;

const router = useRouter();

const isActive = React.useMemo(
() => router.pathname === href,
[href, router.pathname]
);

React.useEffect(() => {
if (isActive && onActive) onActive();
}, [isActive, onActive]);

return (
<Link href={href} {...otherProps}>
{React.cloneElement(child, {
className: createClassName(child.props?.className, {
[activeClassName]: isActive
})
})}
</Link>
);
};

export default ActiveLink;
2 changes: 2 additions & 0 deletions components/ActiveLink/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { default } from "./ActiveLink";
export * from "./ActiveLink";
Loading

0 comments on commit be2d68f

Please sign in to comment.