WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit a620ad1

Browse files
authored
Merge branch 'master' into 499-refactor-icons
2 parents 79383a2 + 2b875ae commit a620ad1

File tree

10 files changed

+57
-41
lines changed

10 files changed

+57
-41
lines changed

src/custom/ConnectionChip/ConnectionChip.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ChipProps, TooltipProps } from '@mui/material';
22
import React from 'react';
33
import { Chip } from '../../base/Chip';
4-
import { Tooltip } from '../../base/Tooltip';
4+
import { CustomTooltip } from '../CustomTooltip';
55

66
export interface ConnectionChipProps {
77
tooltip: string;
@@ -26,7 +26,7 @@ function ConnectionChip({
2626
...rest
2727
}: ConnectionChipProps): JSX.Element {
2828
return (
29-
<Tooltip title={tooltip} placement={tooltipPlacement}>
29+
<CustomTooltip title={tooltip} placement={tooltipPlacement}>
3030
<Chip
3131
sx={{
3232
paddingY: '10px',
@@ -49,7 +49,7 @@ function ConnectionChip({
4949
style={style}
5050
{...rest}
5151
/>
52-
</Tooltip>
52+
</CustomTooltip>
5353
);
5454
}
5555

src/custom/Feedback/FeedbackButton.tsx

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import {
2525
FeedbackTextArea,
2626
HelperWrapper,
2727
InnerComponentWrapper,
28+
NeedHelpComponent,
2829
StyledCheckbox,
2930
StyledLink,
3031
StyledTextArea
@@ -71,16 +72,7 @@ const feedbackData: FeedbackDataItem[] = [
7172
label: 'Meet Request',
7273
isTextInput: false,
7374
innerComponent: (
74-
<div
75-
style={{
76-
display: 'flex',
77-
flexDirection: 'column',
78-
alignItems: 'center',
79-
justifyContent: 'space-between',
80-
height: '137px',
81-
color: 'black'
82-
}}
83-
>
75+
<NeedHelpComponent>
8476
<Typography style={{ lineHeight: '2.5', textAlign: 'center' }}>
8577
Need help or have more feedback than fits here?
8678
<br /> Meet with us.
@@ -91,7 +83,7 @@ const feedbackData: FeedbackDataItem[] = [
9183
>
9284
Select a time convenient for you.
9385
</StyledLink>
94-
</div>
86+
</NeedHelpComponent>
9587
)
9688
}
9789
];

src/custom/Feedback/style.tsx

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import {
99
CULTURED,
1010
DARK_JUNGLE_GREEN,
1111
DARK_KEPPEL,
12-
DARK_PRIMARY_COLOR,
1312
DARK_SLATE_GRAY,
1413
KEPPEL,
1514
MEDIUM_GREY,
@@ -267,13 +266,12 @@ export const FeedbackOptionButton = styled(Button)<FeedbackMessageProps>(({ them
267266
: theme.palette.mode === 'dark'
268267
? SNOW_WHITE
269268
: SNOW_WHITE,
270-
fill: isOpen ? (theme.palette.mode === 'dark' ? CULTURED : DARK_PRIMARY_COLOR) : CULTURED,
271-
stroke: isOpen ? SNOW_WHITE : KEPPEL,
269+
fill: isOpen ? theme.palette.icon.default : SNOW_WHITE,
270+
stroke: isOpen ? theme.palette.icon.inverse : theme.palette.icon.brand,
272271
'&:hover': {
273-
color: theme.palette.mode === 'dark' ? SNOW_WHITE : BLACK,
274-
fill: theme.palette.mode === 'dark' ? CULTURED : DARK_PRIMARY_COLOR,
275-
backgroundColor: WHITE,
276-
stroke: SNOW_WHITE
272+
color: theme.palette.text.default,
273+
backgroundColor: theme.palette.background.hover,
274+
fill: theme.palette.icon.default
277275
}
278276
}));
279277

@@ -298,7 +296,14 @@ export const StyledTextArea = styled('textarea')(({ theme }) => ({
298296
outline: `1px solid ${CARIBBEAN_GREEN}`
299297
}
300298
}));
301-
299+
export const NeedHelpComponent = styled('div')(({ theme }) => ({
300+
display: 'flex',
301+
flexDirection: 'column',
302+
alignItems: 'center',
303+
justifyContent: 'space-between',
304+
height: '137px',
305+
color: theme.palette.text.default
306+
}));
302307
export const StyledLink = styled('a')({
303308
textDecoration: 'underline',
304309
color: 'inherit',

src/custom/LearningCard/LearningCard.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,10 @@ interface Props {
2727
tutorial: Tutorial;
2828
path: string;
2929
courseCount: number;
30+
courseType: string;
3031
}
3132

32-
const LearningCard: React.FC<Props> = ({ tutorial, path, courseCount }) => {
33+
const LearningCard: React.FC<Props> = ({ tutorial, path, courseCount, courseType }) => {
3334
return (
3435
<CardWrapper>
3536
{tutorial.frontmatter.disabled === 'yes' ? (
@@ -77,7 +78,8 @@ const LearningCard: React.FC<Props> = ({ tutorial, path, courseCount }) => {
7778
</CardDesc>
7879
<CardSubdata className="card-subdata">
7980
<p>
80-
{courseCount} Course{courseCount === 1 ? '' : 's'}
81+
{courseCount} {courseType}
82+
{courseCount === 1 ? '' : 's'}
8183
</p>
8284
</CardSubdata>
8385
<CardImage>

src/custom/Modal/index.tsx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,12 @@ const StyledDialog = styled(Dialog)`
5454
}
5555
`;
5656

57-
const StyledHeader = styled('div')(() => ({
58-
background: 'linear-gradient(90deg, #3B687B 0%, #507D90 100%)',
59-
color: '#fff',
57+
const StyledHeader = styled('div')(({ theme }) => ({
58+
background:
59+
theme.palette.mode === 'light'
60+
? 'linear-gradient(90deg, #3B687B 0%, #507D90 100%)'
61+
: 'linear-gradient(90deg, #000 0%, #23363F 100%)',
62+
color: '#eee',
6063
display: 'flex',
6164
justifyContent: 'space-between',
6265
alignItems: 'center',

src/custom/ModalCard/style.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
BUTTON_MODAL,
66
BUTTON_MODAL_DARK,
77
SLIGHT_BLACK_2,
8-
SLIGHT_BLUE
8+
SLIGHT_BLUE,
9+
WHITE
910
} from '../../theme/colors/colors';
1011

1112
export const ContentContainer = styled('div')(({ theme }) => ({
@@ -38,16 +39,13 @@ export const HeaderTypography = styled(Typography)({
3839
export const HeaderModal = styled('div')(({ theme }) => {
3940
const startColor = theme.palette.mode === 'light' ? BUTTON_MODAL : BLACK;
4041
const endColor = theme.palette.mode === 'light' ? SLIGHT_BLUE : SLIGHT_BLACK_2;
41-
42-
const iconColor = theme.palette.icon?.inverse;
43-
4442
return {
4543
display: 'flex',
4644
borderRadius: '5px 5px 0px 0px',
4745
justifyContent: 'space-between',
4846
padding: '11px 16px',
4947
height: '52px',
50-
fill: iconColor,
48+
fill: WHITE,
5149
boxShadow: 'inset 0px -1px 3px 0px rgba(0,0,0,0.2)',
5250
background: `linear-gradient(90deg, ${startColor}, ${endColor})`,
5351
filter:

src/custom/TOCChapter/style.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ export const TOCWrapper = styled('div')(({ theme }) => ({
4040
'.toc-list': {
4141
'& ul': {
4242
position: 'relative',
43-
paddingInlineStart: '3.031rem',
44-
MozPaddingStart: '2.78rem',
43+
paddingInlineStart: '2.65rem',
44+
MozPaddingStart: '2.65rem',
4545
'&::after': {
4646
position: 'absolute',
4747
inset: '1rem auto 1rem 31px',

src/custom/TransferModal/TransferList/TransferList.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ export interface TransferListProps {
3030
assignedPage: () => void;
3131
originalLeftCount: number;
3232
originalRightCount: number;
33+
rightPermission: boolean;
34+
leftPermission: boolean;
3335
}
3436

3537
interface ListItemType {
@@ -58,6 +60,8 @@ function intersection<T>(a: T[], b: T[]): T[] {
5860
* @param {Element} props.emptyStateIconRight - Icon for empty state of list right.
5961
* @param {String} props.emtyStateMessageRight - Message for the empty state of the list right.
6062
* @param {String} props.transferComponentType - Type of the component transfer (There is two types: chip and other).
63+
* @param {Boolean} props.leftPermission - Permission to move data from left to right.
64+
* @param {Boolean} props.rightPermission - Permission to move data from right to left.
6165
*/
6266

6367
function TransferList({
@@ -73,6 +77,8 @@ function TransferList({
7377
emtyStateMessageRight,
7478
originalLeftCount,
7579
originalRightCount,
80+
leftPermission = true,
81+
rightPermission = true,
7682
transferComponentType = TRANSFER_COMPONET.OTHER
7783
}: TransferListProps): JSX.Element {
7884
const [checked, setChecked] = React.useState<ListItemType[]>([]);
@@ -280,7 +286,10 @@ function TransferList({
280286
variant="outlined"
281287
size="small"
282288
onClick={handleAllRight}
283-
disabled={left.length === 0}
289+
disabled={
290+
!rightPermission ||
291+
(rightPermission && (left?.length === 0 || left.length < leftCount))
292+
}
284293
aria-label="move all right"
285294
>
286295
<RightArrowIcon width={18} height={18} />
@@ -290,7 +299,7 @@ function TransferList({
290299
variant="outlined"
291300
size="small"
292301
onClick={handleCheckedRight}
293-
disabled={leftChecked.length === 0}
302+
disabled={!rightPermission || (rightPermission && leftChecked.length === 0)}
294303
aria-label="move selected right"
295304
>
296305
<RightArrowIcon width={18} height={18} />
@@ -299,7 +308,7 @@ function TransferList({
299308
variant="outlined"
300309
size="small"
301310
onClick={handleCheckedLeft}
302-
disabled={rightChecked.length === 0}
311+
disabled={!leftPermission || (leftPermission && rightChecked.length === 0)}
303312
aria-label="move selected left"
304313
>
305314
<LeftArrowIcon width={18} height={18} />
@@ -308,7 +317,10 @@ function TransferList({
308317
variant="outlined"
309318
size="small"
310319
onClick={handleAllLeft}
311-
disabled={right.length === 0}
320+
disabled={
321+
!leftPermission ||
322+
(leftPermission && (right?.length === 0 || right.length < rightCount))
323+
}
312324
aria-label="move all left"
313325
>
314326
<LeftArrowIcon width={18} height={18} />

src/custom/TransferModal/TransferList/style.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { styled } from '@mui/material';
22
import { Button, Chip, Grid, Paper, Typography } from '../../../base';
3+
import { KEPPEL } from '../../../theme';
34

45
export const StyledChip = styled(Chip)(({ theme }) => ({
56
padding: '5px 6px !important',
@@ -46,8 +47,13 @@ export const TransferButton = styled(Button)(({ theme }) => ({
4647
borderRadius: '10px',
4748
borderColor: theme.palette.border?.strong,
4849
boxShadow: 'none',
50+
display: 'flex',
51+
flexDirection: 'row',
52+
fill: theme.palette.icon.default,
4953
'&:hover': {
50-
borderColor: theme.palette.border?.brand
54+
borderColor: theme.palette.border?.brand,
55+
backgroundColor: `${KEPPEL} !important`,
56+
fill: theme.palette.icon.inverse
5157
}
5258
}));
5359

src/theme/typography.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ export const typography = (mode: PaletteMode): TypographyOptions => {
9191
fontSize: '1rem',
9292
fontWeight: 400,
9393
lineHeight: '1.75rem',
94-
display: 'block',
9594
[theme.breakpoints.down('sm')]: {
9695
fontSize: '1rem',
9796
lineHeight: '1.75rem'
@@ -104,7 +103,6 @@ export const typography = (mode: PaletteMode): TypographyOptions => {
104103
fontWeight: 600,
105104
lineHeight: '1.75rem',
106105
textTransform: 'capitalize',
107-
display: 'block',
108106
[theme.breakpoints.down('sm')]: {
109107
fontSize: '1rem',
110108
lineHeight: '1.75rem'

0 commit comments

Comments
 (0)