Skip to content

Commit 88937c8

Browse files
committed
chores:
- add config readme - add features readme - add styles readme - add typography module on styles - restrucure styls folder
1 parent 45702cc commit 88937c8

File tree

17 files changed

+147
-23
lines changed

17 files changed

+147
-23
lines changed

README.md

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
- :fire: Built with CRA but extendable
2222
- Comes with the latest CRA scripts and config
2323
- To extend the CRA webpack config, use `craco.config.js` file. No need to eject
24-
- :chart_with_upwards_trend: Redux and Redux Saga but with less boilerplate <a href="/src/store">More on</a>
24+
- :chart_with_upwards_trend: Redux and Redux Saga but with less boilerplate. See <a href="/src/store">store</a>
2525

2626
- :blue_heart: Ant Design
2727

@@ -33,20 +33,20 @@
3333
- Eslint and prettier configured together for auto save format and error checks
3434
- No git commit allowed if errors and warnings are present
3535

36-
- :raised_hands: Global HTTP error and auth handler <a href="/src/services">More on</a>
36+
- :raised_hands: Global HTTP error and auth handler. See <a href="/src/services">services</a>
3737

38-
- :nail_care: Styled Components and <a href="/src/styles">More on</a>
38+
- :nail_care: Styled Components and more goodies on <a href="/src/styles">styles</a>
3939

4040
- :zap: Codesplitting
4141

4242
- Native React Lazy loaded pages/components with Suspense
4343
- Custom loader animation added
4444

45-
- :capital_abcd: Multilingual <a href="/src/config/translation">More on</a>
45+
- :capital_abcd: Multilingual. See <a href="/src/config">config</a>
4646

47-
- :art: Less and Bootstrap utility classes <a href="/src/styles/utilities">More on</a>
47+
- :art: Less and Bootstrap utility classes. See <a href="/src/styles">styles</a>
4848

49-
- :rocket: Develepment scope based App config file for deployment <a href="/src/config/app">More on</a>
49+
- :rocket: Develepment scope based App config file for deployment. See <a href="/src/config">config</a>
5050

5151
## How To Use
5252

@@ -119,13 +119,23 @@ $ yarn build
119119
This software uses the following open source packages:
120120

121121
- [React](https://reactjs.org/)
122-
- [React Redux](https://react-redux.js.org/)
123122
- [Ant Design](https://ant.design/)
124123
- [Styled Components](https://styled-components.com/)
124+
- [React Redux](https://react-redux.js.org/)
125125
- [Redux Saga](https://redux-saga.js.org/)
126+
- [@reduxjs/toolkit](https://redux-toolkit.js.org/)
127+
- [redux-logger](https://github.com/LogRocket/redux-logger)
128+
- [redux-persist](https://github.com/rt2zz/redux-persist)
126129
- [React Intl](https://formatjs.io/docs/react-intl/)
127130
- [React Router](https://reactrouter.com/)
131+
- [@ant-design/icons](https://github.com/ant-design/ant-design-icons)
128132
- [Axios](https://github.com/axios/axios)
133+
- [Craco](https://github.com/gsoft-inc/craco)
134+
- [@testing-library/react](https://testing-library.com/docs/react-testing-library/intro/)
135+
- [polished](https://polished.js.org/docs/)
136+
- [eslint](https://eslint.org/)
137+
- [prettier](https://prettier.io/)
138+
- [husky](https://typicode.github.io/husky/#/)
129139
- And more..
130140

131141
## License

src/App.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ import { PersistGate } from 'redux-persist/integration/react';
33
import { store, persistor } from 'store';
44
import { Spin } from 'antd';
55
import { loadProgressBar } from 'axios-progress-bar';
6-
import AppStyles from 'styles';
6+
import { GLobalStyles } from 'styles';
77
import { AppProvider } from 'components';
88
import { http } from 'services';
99
import Routes from 'router';
1010
import { Provider } from 'react-redux';
1111
import 'nprogress/nprogress.css';
12-
import 'styles/App.less';
12+
import 'styles/utilities/less/App.less';
1313

1414
function App() {
1515
// load progress bar on every http request by custom axios instance
@@ -19,7 +19,7 @@ function App() {
1919
<Provider store={store}>
2020
<PersistGate loading={<Spin />} persistor={persistor}>
2121
<AppProvider>
22-
<AppStyles />
22+
<GLobalStyles />
2323
<Routes />
2424
</AppProvider>
2525
</PersistGate>

src/config/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
## Feature Pattern based folder structure
2+
3+
> Example directory layout
4+
5+
.
6+
├── app # App config directory
7+
│ │
8+
│ ├── default.js # The default config object .
9+
│ ├── development.js # Config object for development. set by `cross-env REACT_APP_DEPLOY_SCOPE=development`
10+
│ ├── production.js # Config object for development. set by `cross-env REACT_APP_DEPLOY_SCOPE=prdocution`
11+
│ └── index.js # Entry export file for the folder
12+
13+
├── theme # Theme object for Styled components theme provider
14+
├── translation # Translations
15+
│ │
16+
│ ├── entries # JS object config for each locale
17+
│ ├── locales # Json files for each locale containing keys and their translation
18+
│ └── production.js

src/config/app/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/features/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Feature Pattern based folder structure
2+
3+
> Example Feature directory layout
4+
5+
.
6+
├── ExampleFeature # Main folder
7+
│ │
8+
│ ├── ContainerExample.js # A React Container Component example
9+
│ ├── OtherComponent.js # Other component for this features
10+
│ ├── reducer.js # Seperate reducer for this feature
11+
│ ├── saga.js # Saga generator functions for this feature
12+
│ ├── styles.js # Styles only needed for this feature
13+
│ ├── helper.js # helper functions only needed for this feature
14+
│ └── index.js # Entry export file for the folder. eg: exporting the reudcer, saga and if needed other modules.

src/services/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
## Custom HTTP Axios Service
1+
## Services
2+
3+
#### Custom HTTP Axios Service
24

35
- Custom axios middlewares to handle errors on each request by default. But If needed, custom error handling also can be done with the error details sent by the middleware
46
- Auth Token is sent by default if present

src/styles/README.md

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,17 @@
1-
## Custom Styled Components with Antdesign
1+
## Custom Styled Components, Extended Ant Components, Less and more.
22

33
- Component based styling
44
- Custom media queries with JS added as utility with accordance to Ant design breakpoints
5+
- Bootstrap Less utilities
6+
- Modules like Typography eg: Forms.js, Tables.js where we extend Ant Components or create custom styled components for the app is placed here.
7+
8+
> The directory layout
9+
10+
.
11+
├── utilities # App config directory
12+
│ │
13+
│ ├── js # Styling utilities with js.
14+
│ └── less # Bootstrap utility classes generated with less
15+
16+
├── Typography.js # Extended Ant Typography components. app.
17+
└── index.js # Entry exporter file.

src/styles/Typography.js

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import React from 'react';
2+
import { Typography } from 'antd';
3+
import styled from 'styled-components';
4+
import { shade as shadeFunc, tint as tintFunc } from 'polished';
5+
import PropTypes from 'prop-types';
6+
7+
const { Title: AntTitle, Text: AntText, Paragraph: AntParagraph } = Typography;
8+
9+
function getColor(color, shadeValue, tintValue) {
10+
if (shadeValue) {
11+
return shadeFunc(shadeValue, color);
12+
}
13+
if (tintValue) {
14+
return tintFunc(tintValue, color);
15+
}
16+
return tintFunc(0.1, color);
17+
}
18+
19+
const AntTitleStyled = styled(AntTitle)`
20+
&&& {
21+
color: ${props =>
22+
getColor(props.theme[props.color], props.shade, props.tint)};
23+
font-family: 'Cera Pro', sans-serif;
24+
}
25+
`;
26+
27+
const AntTextStyled = styled(AntText)`
28+
&&& {
29+
color: ${props =>
30+
getColor(props.theme[props.color], props.shade, props.tint)};
31+
font-family: 'Cera Pro', sans-serif;
32+
}
33+
`;
34+
35+
const AntParaStyled = styled(AntParagraph)`
36+
&&& {
37+
color: ${props =>
38+
getColor(props.theme[props.color], props.shade, props.tint)};
39+
font-family: 'Cera Pro', sans-serif;
40+
font-size: 1.6rem;
41+
}
42+
`;
43+
44+
export function Title({ color = 'primary', shade, tint, ...rest }) {
45+
return <AntTitleStyled color={color} shade={shade} tint={tint} {...rest} />;
46+
}
47+
48+
export function Text({ color = 'primary', shade, tint, ...rest }) {
49+
return <AntTextStyled color={color} shade={shade} tint={tint} {...rest} />;
50+
}
51+
52+
export function Paragraph({ color = 'primary', shade, tint, ...rest }) {
53+
return <AntParaStyled color={color} shade={shade} tint={tint} {...rest} />;
54+
}
55+
56+
Title.propTypes = {
57+
color: PropTypes.string,
58+
shade: PropTypes.number,
59+
tint: PropTypes.number,
60+
};
61+
62+
Text.propTypes = {
63+
color: PropTypes.string,
64+
shade: PropTypes.number,
65+
tint: PropTypes.number,
66+
};
67+
68+
Paragraph.propTypes = {
69+
color: PropTypes.string,
70+
shade: PropTypes.number,
71+
tint: PropTypes.number,
72+
};

src/styles/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
export { default } from './AppStyles';
1+
export { default as GLobalStyles } from './utilities/js/AppStyles';
22
export { LayoutContent, LayoutContentWrapper } from './layout';

src/styles/utilities/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
export { breakpoints, media, isScreenSize } from './media-query';
1+
export { breakpoints, media, isScreenSize } from './js/media-query';

0 commit comments

Comments
 (0)