Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(components): update antd #267

Merged
merged 81 commits into from
Dec 5, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
81 commits
Select commit Hold shift + click to select a range
a03d432
bump antd version
saha80 Mar 10, 2023
56130a2
preserve antd components' styles
saha80 Mar 14, 2023
0840ef9
move styles from GlobalStyle to components' styles
saha80 Mar 17, 2023
d0bde47
move some global styles to components
saha80 Apr 10, 2023
c273077
fix errors in the console
saha80 Apr 19, 2023
aad8a27
bump antd version
saha80 May 6, 2023
33ea9af
bump antd version
saha80 May 15, 2023
3ad26c8
refactor: ThemeConfigProvider, BaseTable
saha80 May 16, 2023
26770c3
bump antd version
saha80 May 22, 2023
5de3fa4
bump antd version
saha80 May 30, 2023
8adf8c7
fix: components styles
saha80 Jun 5, 2023
2093bec
chore: bump antd version
saha80 Jun 12, 2023
bc52ebc
refactor: remove deprecated, preserve css variables
saha80 Jun 12, 2023
226970e
fix(TrendingCreators): infinite carousel
saha80 Jun 13, 2023
3721b6c
Revert "fix(TrendingCreators): infinite carousel"
saha80 Jun 13, 2023
cae027e
fix(TrendingCreators): jump to next story
saha80 Jun 13, 2023
f64eccd
fix(TrendingCreators): upgrade react-insta-stories
saha80 Jun 16, 2023
b865b6d
refactor: move global styles to components
saha80 Jun 19, 2023
d32376d
reactor(components): preserve styles
saha80 Jun 19, 2023
cd20878
chore: upgrade antd
saha80 Jun 19, 2023
0bf2745
refactor(profileCard): preserve styles
saha80 Jun 19, 2023
25ac4e6
refactor(themeConfig): upgraded antd components
saha80 Jun 19, 2023
bedc419
refactor(Error): preserve styles
saha80 Jun 19, 2023
c5ad6bf
refactor(themeConfig): preserve Table styles
saha80 Jun 19, 2023
f9317ac
chore: upgrade @ant-design/icons
saha80 Jun 20, 2023
8b2fc7e
refactor(Breadcrumb): preserve icon size
saha80 Jun 20, 2023
2720207
refactor(controllers): preserve modal outlined icons
saha80 Jun 20, 2023
418cd6b
refactor: preserve components styles
saha80 Jun 20, 2023
79e557b
chore: upgrade antd
saha80 Jun 25, 2023
14d6e50
refactor(MaskedInput): preserve styles
saha80 Jun 26, 2023
168d295
refactor(BaseSlider): preserve styles
saha80 Jun 26, 2023
8a2363a
refactor: components focus colors
saha80 Jun 27, 2023
9a39b65
refactor: remove css variable aliases
saha80 Jun 27, 2023
c3bec66
chore: bump antd version
saha80 Jul 7, 2023
b8caea3
refactor: type exports
saha80 Jul 12, 2023
3e77268
fix: form optional item color
saha80 Jul 12, 2023
6463421
chore: bump antd version
saha80 Jul 19, 2023
6768160
refactor(MaskedInput): preserve styles
saha80 Jul 19, 2023
fbf5482
refactor(BaseButton): reduce duplicates within selectors
saha80 Jul 19, 2023
98f9189
refactor(BaseSelect): remove duplicate styles
saha80 Jul 19, 2023
e946493
refactor(BaseAlert): move styles to themeConfig
saha80 Jul 19, 2023
c07fd95
refactor(BaseBadge): preserve styles
saha80 Jul 19, 2023
60dfc82
chore: bump antd version
saha80 Jul 20, 2023
1270d30
refactor(BaseButton): update button type "ghost"
saha80 Jul 25, 2023
0aff01c
chore: bump antd version
saha80 Jul 25, 2023
f4fc7ce
refactor(BaseCalendar): remove duplicate style
saha80 Jul 25, 2023
6df4dc5
refactor(BaseCard): decuple styles from BaseCol and BaseRow styles
saha80 Jul 26, 2023
651dc90
refactor(BaseProgress): decuple styles from other component styles
saha80 Jul 26, 2023
57f8a85
refactor(BasePagination): remove duplicate styles
saha80 Jul 27, 2023
0dfdb0d
refactor(BaseMenu): move styles to ThemeConfig
saha80 Jul 27, 2023
a53d9df
refactor: move global styles to component styles
saha80 Jul 29, 2023
ac7cef3
chore: bump antd version
saha80 Aug 4, 2023
81e99cb
fix: deprecations
saha80 Aug 8, 2023
356042c
fix(Form.Item): type definitions
saha80 Aug 8, 2023
037984a
refactor(Select): preserve arrow color
saha80 Aug 8, 2023
7cc2f7b
refactor(TreeTable): remove deprecated TableRowSelection props
saha80 Aug 30, 2023
832a74d
fix(#267): types annotations
saha80 Sep 14, 2023
5edec65
chore(#267): unclear inline style
saha80 Sep 14, 2023
b497034
refactor(#267): replace CSS variables with styled-components theme va…
saha80 Sep 18, 2023
74a040a
refactor(#267): simplify color construction
saha80 Sep 18, 2023
8122257
refactor(#267): move hardcoded values to constants
saha80 Sep 18, 2023
96e4be1
fix(#267): stalled white background
saha80 Sep 19, 2023
fa79b23
refactor: use naming conventions
saha80 Sep 19, 2023
b873195
refactor(styles): precompute hex to RGB color conversion
saha80 Sep 19, 2023
749e0eb
refactor: move components' ThemeConfig to getThemeConfig
saha80 Sep 19, 2023
a7767c9
refactor: remove redundant semicolon
saha80 Sep 19, 2023
5084bca
refactor: prefer unpacking only for the theme.
saha80 Sep 19, 2023
2b4ae0e
refactor(BaseBadge): use status directly
saha80 Sep 19, 2023
f11ede4
refactor: font size and weight from SC
saha80 Sep 25, 2023
425d40d
refactor: media queries, constants
saha80 Nov 12, 2023
ff05388
fix(useResponsive): add missing parentheses
saha80 Nov 12, 2023
cef6587
fix(BaseAlert): success background and border
saha80 Nov 12, 2023
0fe4a1a
fix(BaseSelect): placeholder color
saha80 Nov 12, 2023
e5226f8
fix(BaseTable): row-expand icon incorrect size
saha80 Nov 12, 2023
ae95c71
fix(PhoneItem): missing styles
saha80 Nov 14, 2023
27911ce
fix(styles): fix general issues
Rozhkow Nov 29, 2023
b4db7e6
fix(global): style fixes
Rozhkow Nov 30, 2023
67b1d07
fix(general): fix warnings and remove react simple maps
Rozhkow Nov 30, 2023
def2132
fix(styles): remove styles from ui components file
Rozhkow Dec 1, 2023
f21dda7
fix(styles): general style fixes
Rozhkow Dec 1, 2023
2e3c904
fix(app): fix terminal errors
leineveber Dec 1, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
"url": "https://github.com/altence/lightence-admin/issues"
},
"dependencies": {
"@ant-design/icons": "^4.6.2",
"@ant-design/icons": "^5.0.1",
"@craco/craco": "^6.1.2",
"@lit-labs/react": "^1.0.2",
"@react-google-maps/api": "^2.18.1",
"@reduxjs/toolkit": "^1.7.1",
"antd": "^4.22.4",
"antd": "^5.2.3",
"antd-mask-input": "^2.0.7",
"axios": "^0.24.0",
"axios-mock-adapter": "^1.20.0",
Expand Down Expand Up @@ -68,14 +68,13 @@
"workbox-streams": "^5.1.3"
},
"scripts": {
"start": "yarn buildThemes && craco start",
"build": "yarn buildThemes && craco build",
"start": "craco start",
"build": "craco build",
"test": "craco test",
"eject": "craco eject",
"lint": "eslint \"*/**/*.{js,ts,tsx}\" --fix",
"lint:styles": "stylelint '*/**/*.{js,ts,tsx}'",
"prepare": "husky install",
"buildThemes": "lessc --js --clean-css=\"--s1 --advanced\" src/styles/themes/main.less public/themes/main.css"
"prepare": "husky install"
},
"browserslist": [
">0.2%",
Expand Down Expand Up @@ -105,8 +104,6 @@
"eslint-plugin-react": "^7.24.0",
"eslint-plugin-react-hooks": "^4.3.0",
"husky": "^6.0.0",
"less": "^4.1.2",
"less-plugin-clean-css": "^1.5.1",
"lint-staged": "^11.0.0",
"prettier": "^2.3.1",
"stylelint": "^13.13.1",
Expand Down
1 change: 0 additions & 1 deletion public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<link rel="stylesheet" href="%PUBLIC_URL%/themes/main.css" type = "text/css" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="description" content="Free and easy-to-use admin template based on React 17+" />
<meta name="keywords" content="altence lightence admin template react redux responsive free" />
Expand Down
13 changes: 8 additions & 5 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import { usePWA } from './hooks/usePWA';
import { useThemeWatcher } from './hooks/useThemeWatcher';
import { useAppSelector } from './hooks/reduxHooks';
import { themeObject } from './styles/themes/themeVariables';
import { ThemeConfigProvider } from './styles/ThemeConfigProvider';

const App: React.FC = () => {
const { language } = useLanguage();
Expand All @@ -28,11 +29,13 @@ const App: React.FC = () => {
<>
<meta name="theme-color" content={themeObject[theme].primary} />
<GlobalStyle />
<HelmetProvider>
<ConfigProvider locale={language === 'en' ? enUS : deDe}>
<AppRouter />
</ConfigProvider>
</HelmetProvider>
<ThemeConfigProvider theme={theme}>
<HelmetProvider>
<ConfigProvider locale={language === 'en' ? enUS : deDe}>
<AppRouter />
</ConfigProvider>
</HelmetProvider>
</ThemeConfigProvider>
</>
);
};
Expand Down
4 changes: 2 additions & 2 deletions src/components/apps/newsFeed/NewsFilter/NewsFilter.styles.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import styled from 'styled-components';
import { SearchOutlined, PlusCircleFilled, CloseOutlined } from '@ant-design/icons';
import { DayjsDatePicker } from '@app/components/common/pickers/DayjsDatePicker';
import { BaseDatePicker } from '@app/components/common/pickers/BaseDatePicker';
import { BORDER_RADIUS, FONT_SIZE, FONT_WEIGHT, media } from '@app/styles/themes/constants';
import { BasePopover } from '@app/components/common/BasePopover/BasePopover';
import { BaseInput } from '@app/components/common/inputs/BaseInput/BaseInput';
Expand Down Expand Up @@ -114,7 +114,7 @@ export const Input = styled(BaseInput)`
line-height: 1.375rem;
`;

export const RangePicker = styled(DayjsDatePicker.RangePicker)`
export const RangePicker = styled(BaseDatePicker.RangePicker)`
width: 100%;
margin-bottom: 0.875rem;

Expand Down
4 changes: 4 additions & 0 deletions src/components/common/BaseAlert/BaseAlert.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,8 @@ export const Alert = styled(AntAlert)`
.ant-alert-message {
color: var(--black);
}

.ant-alert-action {
margin-inline-start: 8px;
}
`;
12 changes: 12 additions & 0 deletions src/components/common/BaseBreadcrumb/BaseBreadcrumb.styles.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import styled from 'styled-components';
import { Breadcrumb as AntBreadcrumb } from 'antd';

export const BaseBreadcrumb = styled(AntBreadcrumb)`
&.ant-breadcrumb {
li:last-child {
.ant-breadcrumb-link {
color: var(--text-main-color);
}
}
}
`;
2 changes: 1 addition & 1 deletion src/components/common/BaseBreadcrumb/BaseBreadcrumb.tsx
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export { Breadcrumb as BaseBreadcrumb } from 'antd';
export { BaseBreadcrumb } from './BaseBreadcrumb.styles';
export type { BreadcrumbProps as BaseBreadcrumbProps } from 'antd';
135 changes: 99 additions & 36 deletions src/components/common/BaseButton/BaseButton.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import styled, { css } from 'styled-components';
import { Button as AntButton } from 'antd';
import { Severity } from '@app/interfaces/interfaces';
import { defineColorBySeverity } from '@app/utils/utils';
import { FONT_WEIGHT } from '@app/styles/themes/constants';

interface BtnProps {
$severity?: Severity;
Expand All @@ -14,6 +15,19 @@ export const Button = styled(AntButton)<BtnProps>`
justify-content: center;
gap: 0.3rem;

transition-duration: 0.3s;

font-weight: ${FONT_WEIGHT.semibold};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from styled-components theme

box-shadow: none;

&.ant-btn.ant-btn-icon-only > span {
transform: none;
}

&:not(:disabled):focus-visible {
outline: none;
}

${(props) =>
props.$noStyle &&
css`
Expand All @@ -28,70 +42,119 @@ export const Button = styled(AntButton)<BtnProps>`
&[disabled]:hover {
color: var(--disabled-color);
}
${(props) =>
!props.danger &&
css`
${props.$severity &&
css`
box-shadow: none;
text-shadow: none;
background: rgba(${defineColorBySeverity(props.$severity, true)}, 0.2);

border-color: ${defineColorBySeverity(props.$severity)};

color: ${defineColorBySeverity(props.$severity)};
&.ant-btn-dangerous {
&.ant-btn-primary {
box-shadow: none;
}

&:hover {
background: var(--background-color);
&.ant-btn-text:not(:disabled):hover {
background-color: transparent;
}
}

border-color: rgba(${defineColorBySeverity(props.$severity, true)}, 0.9);
${(props) =>
!props.danger &&
css`
&.ant-btn-default,
&.ant-btn-dashed {
&:focus {
background-color: var(--background-color);
}

color: rgba(${defineColorBySeverity(props.$severity, true)}, 0.9);
&:focus,
&:not(:disabled):hover {
color: var(--ant-primary-color-hover);
border-color: var(--ant-primary-color-hover);
}
}

&.ant-btn-text {
&:focus {
background: var(--background-color);

border-color: rgba(${defineColorBySeverity(props.$severity, true)}, 0.9);

color: rgba(${defineColorBySeverity(props.$severity, true)}, 0.9);
background-color: rgba(0, 0, 0, 0.018);
}
`}

${props.type === 'text' &&
css`
&:hover {
&:not(:disabled):hover {
background: transparent;
color: var(--secondary-color);
}
`}
}

${props.type === 'ghost' &&
css`
&:hover {
color: var(--secondary-color);
&.ant-btn-ghost {
color: var(--primary-color);
border-color: var(--primary-color);

&:disabled {
cursor: not-allowed;
color: var(--disabled-color);
border-color: var(--border-base-color);
background-color: var(--disabled-bg-color);
}

&:focus {
color: var(--ant-primary-color-hover);
border-color: var(--ant-primary-color-hover);
}

&:not(:disabled):hover {
color: var(--secondary-color);
border-color: var(--secondary-color);
}
`}
}

${props.type === 'primary' &&
css`
&.ant-btn-primary:not(:disabled) {
background: var(--primary-color);

&:focus {
border-color: var(--ant-primary-color-hover);
background: var(--ant-primary-color-hover);
}

&:hover {
background: var(--secondary-color);

border-color: var(--secondary-color);
}
`}
}

&.ant-btn-link {
color: var(--primary-color);

&:disabled {
color: var(--disabled-color);
}

&:focus {
color: var(--ant-primary-color-hover);
}

&:not(:disabled):hover {
text-decoration: none;
color: var(--ant-primary-color-hover);
}

${props.type === 'link' &&
css`
& span,
a {
text-decoration: underline;
}
`};
}

${props.$severity &&
css`
background: rgba(${defineColorBySeverity(props.$severity, true)}, 0.2);

border-color: ${defineColorBySeverity(props.$severity)};

color: ${defineColorBySeverity(props.$severity)};

&.ant-btn-default:focus,
&.ant-btn-default:not(:disabled):hover {
background: var(--background-color);

border-color: rgba(${defineColorBySeverity(props.$severity, true)}, 0.9);

color: rgba(${defineColorBySeverity(props.$severity, true)}, 0.9);
}
`}
`}
`;
2 changes: 2 additions & 0 deletions src/components/common/BaseCalendar/BaseCalendar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export { Calendar as BaseCalendar } from 'antd';
export type { CalendarProps as BaseCalendarProps } from 'antd';
10 changes: 10 additions & 0 deletions src/components/common/BaseCard/BaseCard.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ export const Card = styled(AntCard)<CardInternalProps>`
box-shadow: var(--box-shadow);

.ant-card-head {
padding-top: 15px;
padding-bottom: 15px;
min-height: 36px;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?


border-bottom: 0;

font-weight: ${FONT_WEIGHT.bold};
Expand All @@ -27,6 +31,12 @@ export const Card = styled(AntCard)<CardInternalProps>`
padding-bottom: 0;
}

@media only screen and ${media.md} {
padding-top: 20px;
padding-bottom: 0;
min-height: 48px;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

}

@media only screen and ${media.xl} {
font-size: ${FONT_SIZE.xxl};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from SC


Expand Down
12 changes: 8 additions & 4 deletions src/components/common/BaseCheckbox/BaseCheckbox.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,20 @@ export const Checkbox = styled(AntdCheckbox)`
border: 1px solid var(--primary-color);
}

.ant-checkbox-disabled.ant-checkbox-checked .ant-checkbox-inner::after {
border-color: var(--disabled-color);
.ant-checkbox-disabled .ant-checkbox-inner {
border-color: var(--border-base-color);
}

.ant-checkbox-disabled + span {
color: var(--disabled-color);
&.ant-checkbox-disabled.ant-checkbox-checked .ant-checkbox-inner::after {
border-color: var(--disabled-color);
}
`;

export const CheckboxGroup = styled(Group)`
.ant-form-vertical &.ant-checkbox-group {
display: inline-block;
}

& .ant-checkbox-inner {
border-radius: 0.1875rem;
height: 1.25rem;
Expand Down
1 change: 1 addition & 0 deletions src/components/common/BaseFeed/BaseFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const BaseFeed: React.FC<BaseFeedProps> = ({ next, hasMore, target = 'mai
</S.SpinnerWrapper>
}
scrollableTarget={target}
style={{ overflow: 'visible' }}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why?

Copy link
Collaborator Author

@saha80 saha80 Sep 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ankeetmaini/react-infinite-scroll-component#228

without style={{ overflow: 'visible' }} scroll bar appears
image

>
<S.NewsWrapper>{children}</S.NewsWrapper>
</InfiniteScroll>
Expand Down
Loading