Skip to content

Commit ce7c2aa

Browse files
author
Clement Mwimo
committed
Merge branch 'cmwimo/CT-2389' into cmwimo/CT-2392
2 parents 67d937b + d83202c commit ce7c2aa

30 files changed

Lines changed: 264 additions & 277 deletions

architectureDecisionRecords/0001Styling.md

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,18 @@ Tailwind pollutes your jsx with a lot of classnames, and requires you to learn a
1414

1515
CSS modules gives a lot of the benefits of styled components, but with faster performance. Using CSS modules will keep our basic css skills in tact.
1616

17+
We also need to work with both CSS modules and MXUI. MXUI uses [MUI](https://mui.com/) under the hood, which provides its own styling mechanisms (the `sx` and `xs` props). This means we need clear guidance on when to reach for CSS modules versus MUI's built-in styling props.
18+
1719
## Decision
1820

1921
We will use CSS modules to style our html.
2022

23+
When we need to add spacing between two elements, we should use a MUI [Stack](https://mui.com/material-ui/react-stack/) with a `spacing` prop.
24+
25+
When styling elements we should use CSS modules instead of using the `sx` or `xs` props that MUI provides. The only exception to using the `xs` prop is if you need to write breakpoint specific code. MUI does not expose its breakpoints as css theme variables.
26+
27+
When using a Stack we can use all the flexbox related props directly on the Stack except for `gap` and `flexDirection`. We should use the Stack's `direction` and `spacing` props instead. This allows us to quickly write layout code without having to make specific classes for every stack.
28+
2129
## Consequences
2230

23-
We will have a performant and easy to use system for styling.
31+
We will have a performant and easy to use system for styling that works consistently across CSS modules and MXUI/MUI.
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Title
2+
3+
Small Pull Requests
4+
5+
## Date proposed
6+
7+
08-13-2026
8+
9+
## Context
10+
11+
Large pull requests have the following issues:
12+
13+
1. Exhausting and time consuming to review
14+
1. Even more exhausting to re-review
15+
1. Higher likelihood of important things being missed
16+
1. Higher likelihood of suboptimal work being approved
17+
1. Slow feedback cycle. You can follow a suboptimal path for longer before getting feedback. This results in more wasted work.
18+
1. Big merge conflicts
19+
20+
## Decision
21+
22+
We will strive to create small, focused pull requests that fulfill a single purpose.
23+
24+
## Consequences
25+
26+
Code will get merged faster. Code will be of higher quality. Fewer bugs will be introduced. Less time will be wasted on suboptimal paths.

src/ConnectedTokenProvider.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,17 @@ const connectThemeOverrides = (palette: Theme['palette']) => ({
112112
},
113113
},
114114
},
115+
MuiButton: {
116+
styleOverrides: {
117+
// MUI sizes icon slot children off the button size (medium 20px, large 22px),
118+
// which beats the Icon's own size prop. Our chevrons are always 24px.
119+
endIcon: {
120+
'& > *:nth-of-type(1)': {
121+
fontSize: '24px',
122+
},
123+
},
124+
},
125+
},
115126
MuiChip: {
116127
styleOverrides: {
117128
label: {
@@ -193,6 +204,7 @@ export const ConnectedTokenProvider = ({ children }: Props): React.ReactNode =>
193204
'--mui-palette-primary-dark': combinedTheme.palette.primary.dark,
194205
'--mui-palette-primary-contrastText': combinedTheme.palette.primary.contrastText,
195206
'--mui-palette-error-main': combinedTheme.palette.error.main,
207+
'--mui-palette-error-contrastText': combinedTheme.palette.error.contrastText,
196208
'--mui-palette-text-primary': combinedTheme.palette.text.primary,
197209
'--mui-palette-text-secondary': combinedTheme.palette.text.secondary,
198210
'--mui-palette-background-default': combinedTheme.palette.background.default,

src/components/ConnectSuccessSurvey.module.css

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
width: 100%;
1919
}
2020

21-
.errorMessageText:global(.MuiTypography-root) {
22-
font-size: 12px;
23-
}
24-
2521
.toggleButton:global(.MuiToggleButton-root) {
2622
align-items: center;
2723
color: var(--mui-palette-primary-main);

src/components/ConnectSuccessSurvey.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export const ConnectSuccessSurvey = React.forwardRef<
169169
spacing={0.5}
170170
>
171171
<Icon color="error" fill={true} name="error" size={16} />
172-
<Text className={styles.errorMessageText} color="error" variant="XSmall">
172+
<Text color="error" truncate={false} variant="ParagraphSmall">
173173
{__('Please select an option before continuing.')}
174174
</Text>
175175
</Stack>

src/components/DeleteMemberSurvey.js

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,9 @@ export const DeleteMemberSurvey = (props) => {
148148
'Why do you want to disconnect %1?',
149149
member.name,
150150
)}
151-
<span className={styles.asterisk}>*</span>
151+
<Text color="error" component="span" truncate={false} variant="Paragraph">
152+
*
153+
</Text>
152154
</Text>
153155
</FormLabel>
154156
<div>
@@ -174,9 +176,18 @@ export const DeleteMemberSurvey = (props) => {
174176
</Stack>
175177
</FormControl>
176178

177-
<span className={styles.requiredNote}>
178-
<span className={styles.requiredNoteAsterisk}>*</span> {__('Required')}
179-
</span>
179+
<Text
180+
className={styles.requiredNote}
181+
color="textSecondary"
182+
component="span"
183+
truncate={false}
184+
variant="Small"
185+
>
186+
<Text color="error" component="span" truncate={false} variant="Small">
187+
*
188+
</Text>{' '}
189+
{__('Required')}
190+
</Text>
180191
</Stack>
181192

182193
{isSubmitted && !selectedReason && (

src/components/DeleteMemberSurvey.module.css

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,22 +14,10 @@
1414
width: 100%;
1515
}
1616

17-
.asterisk {
18-
color: var(--mui-palette-error-main);
19-
font-size: 15px;
20-
}
21-
22-
.requiredNote {
23-
color: var(--mui-palette-text-secondary);
24-
font-size: 13px;
17+
.requiredNote:global(.MuiTypography-root) {
2518
margin-bottom: var(--spacing-1-point-5);
2619
}
2720

28-
.requiredNoteAsterisk {
29-
color: var(--mui-palette-error-main);
30-
font-size: 13px;
31-
}
32-
3321
.buttons:global(.MuiStack-root) {
3422
margin-top: var(--spacing-2-point-5);
3523
}

src/components/GenericError.module.css

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
.container:global(.MuiStack-root) {
2-
background-color: var(--mui-palette-common-white);
2+
background-color: var(--mui-palette-background-paper);
33
height: 100%;
44
text-align: center;
55
}

src/components/InstitutionTile.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import { __ } from 'src/utilities/Intl'
66
import { useTokens } from '@kyper/tokenprovider'
77

88
import { Button, Chip } from '@mui/material'
9-
import { ChevronRight } from '@kyper/icon/ChevronRight'
10-
import { InstitutionLogo } from '@mxenabled/mxui'
9+
import { Icon, InstitutionLogo } from '@mxenabled/mxui'
1110

1211
import { formatUrl } from 'src/utilities/FormatUrl'
1312
import {
@@ -34,11 +33,7 @@ export const InstitutionTile = (props) => {
3433
aria-label={__('Add account with %1', institution.name)}
3534
className={'institutionButton '}
3635
data-test={`${institution.name.replace(/\s+/g, '-')}-row`}
37-
endIcon={
38-
!institution.is_disabled_by_client && (
39-
<ChevronRight color={tokens.TextColor.Default} height={16} width={16} />
40-
)
41-
}
36+
endIcon={!institution.is_disabled_by_client && <Icon name="chevron_right" size={24} />}
4237
fullWidth={true}
4338
onClick={selectInstitution}
4439
startIcon={

src/components/RequiredFieldNote.module.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55

66
.note:global(.MuiTypography-root) {
77
color: var(--mui-palette-text-secondary);
8-
font-size: 13px;
98
}
109

1110
.asterisk:global(.MuiTypography-root) {

0 commit comments

Comments
 (0)