Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Commit

Permalink
Merge pull request #129 from Groww/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
vikaz596 authored Nov 23, 2021
2 parents dc0424e + 4ae711d commit 2789e9b
Show file tree
Hide file tree
Showing 5 changed files with 125 additions and 55 deletions.
16 changes: 11 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "@groww-tech/ui-toolkit",
"version": "0.0.9",
"version": "0.0.10",
"description": "A lightning nature UI",
"main": "dist/index.js",
"module": "dist/index.es.js",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
"types": "dist/types",
"files": [
"/dist"
Expand Down Expand Up @@ -38,6 +38,10 @@
{
"name": "Ganesh Hegde",
"url": "https://twitter.com/the_ganeshhegde"
},
{
"name": "Aditya Vandan Sharma",
"url": "https://twitter.com/AdityaVandan"
}
],
"license": "MIT",
Expand All @@ -55,7 +59,7 @@
"lint:types": "tsc --noEmit",
"storybook": "start-storybook -p 6006",
"build-storybook": "build-storybook",
"pushTags" : "PACKAGE_VERSION=$(cat package.json | grep \\\"version\\\" | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag -a v$PACKAGE_VERSION -m \"@groww-tech/ui-toolkit-v$PACKAGE_VERSION\" && git push --tags"
"pushTags": "PACKAGE_VERSION=$(cat package.json | grep \\\"version\\\" | head -1 | awk -F: '{ print $2 }' | sed 's/[\",]//g' | tr -d '[[:space:]]') && git tag -a v$PACKAGE_VERSION -m \"@groww-tech/ui-toolkit-v$PACKAGE_VERSION\" && git push --tags"
},
"peerDependencies": {
"classnames": "^2.2.6",
Expand Down Expand Up @@ -88,6 +92,7 @@
"babel-loader": "^8.2.2",
"classnames": "^2.2.6",
"concurrently": "^6.0.2",
"copyfiles": "^2.4.1",
"eslint": "^7.22.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-react": "^7.23.1",
Expand All @@ -97,6 +102,7 @@
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-lazyload": "^2.6.9",
"rimraf": "^3.0.2",
"rollup": "^2.45.2",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-copy": "^3.4.0",
Expand All @@ -108,7 +114,7 @@
"typescript": "^4.2.4"
},
"dependencies": {
"@groww-tech/icon-store": "0.0.9",
"@groww-tech/icon-store": "0.0.10",
"lodash.debounce": "^4.0.8",
"react-waypoint": "^10.1.0"
}
Expand Down
99 changes: 57 additions & 42 deletions rollup.config.js
Original file line number Diff line number Diff line change
@@ -1,56 +1,71 @@
import babel from 'rollup-plugin-babel';
import commonjs from '@rollup/plugin-commonjs';
import resolve from '@rollup/plugin-node-resolve';
import external from 'rollup-plugin-peer-deps-external';
import { terser } from 'rollup-plugin-terser';
import postcss from 'rollup-plugin-postcss';
import postcssImport from 'postcss-import';
import postcssUrl from 'postcss-url';
import typescript from 'rollup-plugin-typescript';
import postcssImport from "postcss-import";
import postcssUrl from "postcss-url";
import babel from "rollup-plugin-babel";
import copy from "rollup-plugin-copy";
import filesize from "rollup-plugin-filesize";
import copy from 'rollup-plugin-copy'
import external from "rollup-plugin-peer-deps-external";
import postcss from "rollup-plugin-postcss";
import { terser } from "rollup-plugin-terser";
import typescript from "rollup-plugin-typescript";

import commonjs from "@rollup/plugin-commonjs";
import resolve from "@rollup/plugin-node-resolve";

import { getInputFiles } from "./rollup.input";

// import pkg from './package.json';

const commonConfig = {
plugins: [
commonjs(),
postcss({
plugins: [ postcssImport(), postcssUrl({ url: 'inline' }) ],
extract: true,
extract: 'index.css',
extensions: [ '.css' ]
}),
typescript(),
babel({
exclude: 'node_modules/**',
presets: [ '@babel/preset-typescript', '@babel/preset-react' ],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods'
]
}),
external(),
resolve(),
terser(),
filesize(),
copy({
targets: [
{ src: 'src/types', dest: 'dist' }
]
})
],
external: [ 'react', 'react-dom', 'classnames', 'react-lazyload' ]

};

export default [
{
input: './src/index.ts',
output: [
{
file: 'dist/index.js',
dir: 'dist/cjs',
format: 'cjs'
},
{
file: 'dist/index.es.js',
format: 'es',
exports: 'named'
}
],
plugins: [
commonjs(),
postcss({
plugins: [postcssImport(), postcssUrl({ url: 'inline' })],
extract: true,
extensions: [".css"],
}),
typescript(),
babel({
exclude: 'node_modules/**',
presets: ['@babel/preset-typescript', '@babel/preset-react'],
plugins: [
'@babel/plugin-proposal-class-properties',
'@babel/plugin-proposal-private-methods',
]
}),
external(),
resolve(),
terser(),
filesize(),
copy({
targets: [
{ src: 'src/types', dest: 'dist' }
]
})
...commonConfig
},
{
input: getInputFiles(),
output: [
{
dir: 'dist/esm',
format: 'es'
}
],
external: ['react', 'react-dom', 'classnames', 'react-lazyload']
...commonConfig
}
];
43 changes: 43 additions & 0 deletions rollup.input.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const fs = require('fs');

const fileTypes = [ '.ts', '.jsx', '.ts', '.tsx' ];

/*
getModulePath generates an array of paths to components present in the atom or molecule
for e.g. by calling getModulePaths('./src/components','molecules') the function will generate the following array:
[
'./src/components/molecules/Carousel/index.jsx',
'./src/components/molecules/CheckBoxGroup/index.ts',
'./src/components/molecules/RadioButtonGroup/index.ts',
]
*/

function getModulePaths(path, componentType) {
const moduleList = fs.readdirSync(path + '/' + componentType);

const modulePaths = [];

moduleList.forEach((module) => {
fileTypes.every((fileType) => {
const componentPathCandidate = `${path}/${componentType}/${module}/index${fileType}`;

if (fs.existsSync(componentPathCandidate)) {
modulePaths.push(componentPathCandidate);
return false; // break loop
}

return true; // continue loop
});

});

return modulePaths;
}

export function getInputFiles() {
return [
'./src/index.ts',
...getModulePaths('./src/components', 'atoms'),
...getModulePaths('./src/components', 'molecules')
];
}
19 changes: 13 additions & 6 deletions src/components/atoms/Table/Components/TableHeaderCell.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
import React, { ReactNode } from 'react';
import React, { ReactNode } from "react";

import { ArrowDropDown, ArrowDropUp } from '@groww-tech/icon-store/mi';
import cn from 'classnames';
import cn from "classnames";

import {
ArrowDropDown,
ArrowDropUp,
} from "@groww-tech/icon-store/mi";

type SortConfig = {
iconClass?: string;
Expand Down Expand Up @@ -47,7 +50,7 @@ const TableHeaderCell = (props: React.ThHTMLAttributes<HTMLTableCellElement> & P

const classes = cn(className, { 'tb10SelectHeaderCell': sortConfig?.isSelected });
const customIconClass = sortConfig?.iconClass || '';
const iconClasses = cn('tb10IconClass', customIconClass, { 'tb10HideIcon': sortConfig?.hideIcon, 'primaryClr': sortConfig?.isSelected });
const iconClasses = cn('pos-rel tb10IconClass', customIconClass, { 'tb10HideIcon': sortConfig?.hideIcon, 'primaryClr': sortConfig?.isSelected });

return (
<th
Expand All @@ -59,8 +62,12 @@ const TableHeaderCell = (props: React.ThHTMLAttributes<HTMLTableCellElement> & P
{children}
{
sortConfig?.ascending
? <ArrowDropUp className={iconClasses} />
: <ArrowDropDown className={iconClasses} />
? <ArrowDropUp
className={iconClasses}
/>
: <ArrowDropDown
className={iconClasses}
/>
}
</th>
);
Expand Down
3 changes: 1 addition & 2 deletions src/components/atoms/Table/table.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,5 @@
}

.tb10IconClass {
width: 17px !important;
height: 17px !important;
top: 6px;
}

0 comments on commit 2789e9b

Please sign in to comment.