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

Commit 2789e9b

Browse files
authored
Merge pull request #129 from Groww/develop
Develop
2 parents dc0424e + 4ae711d commit 2789e9b

5 files changed

Lines changed: 125 additions & 55 deletions

File tree

package.json

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
22
"name": "@groww-tech/ui-toolkit",
3-
"version": "0.0.9",
3+
"version": "0.0.10",
44
"description": "A lightning nature UI",
5-
"main": "dist/index.js",
6-
"module": "dist/index.es.js",
5+
"main": "dist/cjs/index.js",
6+
"module": "dist/esm/index.js",
77
"types": "dist/types",
88
"files": [
99
"/dist"
@@ -38,6 +38,10 @@
3838
{
3939
"name": "Ganesh Hegde",
4040
"url": "https://twitter.com/the_ganeshhegde"
41+
},
42+
{
43+
"name": "Aditya Vandan Sharma",
44+
"url": "https://twitter.com/AdityaVandan"
4145
}
4246
],
4347
"license": "MIT",
@@ -55,7 +59,7 @@
5559
"lint:types": "tsc --noEmit",
5660
"storybook": "start-storybook -p 6006",
5761
"build-storybook": "build-storybook",
58-
"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"
62+
"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"
5963
},
6064
"peerDependencies": {
6165
"classnames": "^2.2.6",
@@ -88,6 +92,7 @@
8892
"babel-loader": "^8.2.2",
8993
"classnames": "^2.2.6",
9094
"concurrently": "^6.0.2",
95+
"copyfiles": "^2.4.1",
9196
"eslint": "^7.22.0",
9297
"eslint-plugin-import": "^2.22.1",
9398
"eslint-plugin-react": "^7.23.1",
@@ -97,6 +102,7 @@
97102
"react": "^16.12.0",
98103
"react-dom": "^16.12.0",
99104
"react-lazyload": "^2.6.9",
105+
"rimraf": "^3.0.2",
100106
"rollup": "^2.45.2",
101107
"rollup-plugin-babel": "^4.4.0",
102108
"rollup-plugin-copy": "^3.4.0",
@@ -108,7 +114,7 @@
108114
"typescript": "^4.2.4"
109115
},
110116
"dependencies": {
111-
"@groww-tech/icon-store": "0.0.9",
117+
"@groww-tech/icon-store": "0.0.10",
112118
"lodash.debounce": "^4.0.8",
113119
"react-waypoint": "^10.1.0"
114120
}

rollup.config.js

Lines changed: 57 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,56 +1,71 @@
1-
import babel from 'rollup-plugin-babel';
2-
import commonjs from '@rollup/plugin-commonjs';
3-
import resolve from '@rollup/plugin-node-resolve';
4-
import external from 'rollup-plugin-peer-deps-external';
5-
import { terser } from 'rollup-plugin-terser';
6-
import postcss from 'rollup-plugin-postcss';
7-
import postcssImport from 'postcss-import';
8-
import postcssUrl from 'postcss-url';
9-
import typescript from 'rollup-plugin-typescript';
1+
import postcssImport from "postcss-import";
2+
import postcssUrl from "postcss-url";
3+
import babel from "rollup-plugin-babel";
4+
import copy from "rollup-plugin-copy";
105
import filesize from "rollup-plugin-filesize";
11-
import copy from 'rollup-plugin-copy'
6+
import external from "rollup-plugin-peer-deps-external";
7+
import postcss from "rollup-plugin-postcss";
8+
import { terser } from "rollup-plugin-terser";
9+
import typescript from "rollup-plugin-typescript";
1210

11+
import commonjs from "@rollup/plugin-commonjs";
12+
import resolve from "@rollup/plugin-node-resolve";
13+
14+
import { getInputFiles } from "./rollup.input";
15+
16+
// import pkg from './package.json';
17+
18+
const commonConfig = {
19+
plugins: [
20+
commonjs(),
21+
postcss({
22+
plugins: [ postcssImport(), postcssUrl({ url: 'inline' }) ],
23+
extract: true,
24+
extract: 'index.css',
25+
extensions: [ '.css' ]
26+
}),
27+
typescript(),
28+
babel({
29+
exclude: 'node_modules/**',
30+
presets: [ '@babel/preset-typescript', '@babel/preset-react' ],
31+
plugins: [
32+
'@babel/plugin-proposal-class-properties',
33+
'@babel/plugin-proposal-private-methods'
34+
]
35+
}),
36+
external(),
37+
resolve(),
38+
terser(),
39+
filesize(),
40+
copy({
41+
targets: [
42+
{ src: 'src/types', dest: 'dist' }
43+
]
44+
})
45+
],
46+
external: [ 'react', 'react-dom', 'classnames', 'react-lazyload' ]
47+
48+
};
1349

1450
export default [
1551
{
1652
input: './src/index.ts',
1753
output: [
1854
{
19-
file: 'dist/index.js',
55+
dir: 'dist/cjs',
2056
format: 'cjs'
21-
},
22-
{
23-
file: 'dist/index.es.js',
24-
format: 'es',
25-
exports: 'named'
2657
}
2758
],
28-
plugins: [
29-
commonjs(),
30-
postcss({
31-
plugins: [postcssImport(), postcssUrl({ url: 'inline' })],
32-
extract: true,
33-
extensions: [".css"],
34-
}),
35-
typescript(),
36-
babel({
37-
exclude: 'node_modules/**',
38-
presets: ['@babel/preset-typescript', '@babel/preset-react'],
39-
plugins: [
40-
'@babel/plugin-proposal-class-properties',
41-
'@babel/plugin-proposal-private-methods',
42-
]
43-
}),
44-
external(),
45-
resolve(),
46-
terser(),
47-
filesize(),
48-
copy({
49-
targets: [
50-
{ src: 'src/types', dest: 'dist' }
51-
]
52-
})
59+
...commonConfig
60+
},
61+
{
62+
input: getInputFiles(),
63+
output: [
64+
{
65+
dir: 'dist/esm',
66+
format: 'es'
67+
}
5368
],
54-
external: ['react', 'react-dom', 'classnames', 'react-lazyload']
69+
...commonConfig
5570
}
5671
];

rollup.input.js

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const fs = require('fs');
2+
3+
const fileTypes = [ '.ts', '.jsx', '.ts', '.tsx' ];
4+
5+
/*
6+
getModulePath generates an array of paths to components present in the atom or molecule
7+
for e.g. by calling getModulePaths('./src/components','molecules') the function will generate the following array:
8+
[
9+
'./src/components/molecules/Carousel/index.jsx',
10+
'./src/components/molecules/CheckBoxGroup/index.ts',
11+
'./src/components/molecules/RadioButtonGroup/index.ts',
12+
]
13+
*/
14+
15+
function getModulePaths(path, componentType) {
16+
const moduleList = fs.readdirSync(path + '/' + componentType);
17+
18+
const modulePaths = [];
19+
20+
moduleList.forEach((module) => {
21+
fileTypes.every((fileType) => {
22+
const componentPathCandidate = `${path}/${componentType}/${module}/index${fileType}`;
23+
24+
if (fs.existsSync(componentPathCandidate)) {
25+
modulePaths.push(componentPathCandidate);
26+
return false; // break loop
27+
}
28+
29+
return true; // continue loop
30+
});
31+
32+
});
33+
34+
return modulePaths;
35+
}
36+
37+
export function getInputFiles() {
38+
return [
39+
'./src/index.ts',
40+
...getModulePaths('./src/components', 'atoms'),
41+
...getModulePaths('./src/components', 'molecules')
42+
];
43+
}

src/components/atoms/Table/Components/TableHeaderCell.tsx

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
import React, { ReactNode } from 'react';
1+
import React, { ReactNode } from "react";
22

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

5+
import {
6+
ArrowDropDown,
7+
ArrowDropUp,
8+
} from "@groww-tech/icon-store/mi";
69

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

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

5255
return (
5356
<th
@@ -59,8 +62,12 @@ const TableHeaderCell = (props: React.ThHTMLAttributes<HTMLTableCellElement> & P
5962
{children}
6063
{
6164
sortConfig?.ascending
62-
? <ArrowDropUp className={iconClasses} />
63-
: <ArrowDropDown className={iconClasses} />
65+
? <ArrowDropUp
66+
className={iconClasses}
67+
/>
68+
: <ArrowDropDown
69+
className={iconClasses}
70+
/>
6471
}
6572
</th>
6673
);

src/components/atoms/Table/table.css

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,5 @@
4949
}
5050

5151
.tb10IconClass {
52-
width: 17px !important;
53-
height: 17px !important;
52+
top: 6px;
5453
}

0 commit comments

Comments
 (0)