Skip to content

Commit 836aff2

Browse files
committed
fix(styles): update theme property access in styled components
- Refactored styled components to access theme properties without optional chaining, ensuring consistency and compatibility with the updated theme structure. - Adjusted box-shadow properties across various components to align with the new theme shadow naming conventions.
1 parent 9583a5a commit 836aff2

File tree

19 files changed

+43
-38
lines changed

19 files changed

+43
-38
lines changed

src/components/Diagrams/AiIntegrationProcessDiagram/AiIntegrationProcessDiagram.styles.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ export const DiagramContainer = styled.div`
1010
h3 {
1111
font-size: 1.5rem;
1212
margin-bottom: 1rem;
13-
color: ${({ theme }) => theme.colors?.text?.primary || '#333'};
13+
color: ${({ theme }) => theme.colors.text.primary || '#333'};
1414
text-align: center;
1515
}
1616
1717
p {
18-
color: ${({ theme }) => theme.colors?.text?.secondary || '#666'};
18+
color: ${({ theme }) => theme.colors.text.secondary || '#666'};
1919
margin-bottom: 1.5rem;
2020
text-align: center;
2121
max-width: 800px;
@@ -27,5 +27,5 @@ export const DiagramWrapper = styled.div`
2727
max-width: 1000px;
2828
border-radius: 8px;
2929
overflow: hidden;
30-
box-shadow: ${({ theme }) => theme.shadows?.elevation2 || '0 4px 6px rgba(0, 0, 0, 0.1)'};
30+
box-shadow: ${({ theme }) => theme.shadows.elevation2 || '0 4px 6px rgba(0, 0, 0, 0.1)'};
3131
`;

src/components/Diagrams/FlowchartDiagram/FlowchartDiagram.styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const DiagramContainer = styled.div<DiagramContainerProps>`
5858
background-color: ${props => props.$backgroundColor || 'rgba(74, 158, 255, 0.05)'};
5959
border-radius: 8px;
6060
overflow: hidden;
61-
box-shadow: ${({ theme }) => theme.shadows?.small || '0px 2px 4px rgba(0, 0, 0, 0.1)'};
61+
box-shadow: ${({ theme }) => theme.shadows.sm || '0px 2px 4px rgba(0, 0, 0, 0.1)'};
6262
6363
.react-flow__viewport {
6464
transition: transform 0.2s ease;

src/components/Diagrams/_wrappers/DiagramClientWrapper/DiagramClientWrapper.styles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ export const DiagramContainer = styled.div<DiagramContainerProps>`
1919
h3 {
2020
font-size: 1.5rem;
2121
margin-bottom: 0.5rem;
22-
color: ${({ theme }) => theme.colors?.text?.primary || '#333'};
22+
color: ${({ theme }) => theme.colors.text.primary || '#333'};
2323
}
2424
2525
p {
2626
font-size: 1rem;
2727
line-height: 1.5;
28-
color: ${({ theme }) => theme.colors?.text?.secondary || '#666'};
28+
color: ${({ theme }) => theme.colors.text.secondary || '#666'};
2929
margin-bottom: 1rem;
3030
}
3131
`;

src/shared-components/molecules/ComparisonTable/ComparisonTable.styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export const Table = styled.table<StyledTableProps>`
1616
border-spacing: 0;
1717
border-radius: 8px;
1818
overflow: hidden;
19-
box-shadow: ${({ theme }) => theme.shadows.medium};
19+
box-shadow: ${({ theme }) => theme.shadows.md};
2020
opacity: 0;
2121
transition: opacity 0.6s ease-out;
2222

src/shared-components/molecules/MermaidDiagram/MermaidDiagram.styles.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export const DiagramContainer = styled.div<DiagramContainerProps>`
1212
background-color: ${({ $backgroundColor, theme }) => $backgroundColor || theme.colors.background.light};
1313
border-radius: 8px;
1414
overflow: hidden;
15-
box-shadow: ${({ theme }) => theme.shadows.small};
15+
box-shadow: ${({ theme }) => theme.shadows.sm};
1616
display: flex;
1717
justify-content: center;
1818
align-items: center;

src/shared-components/molecules/ReactFlowDiagram/EnhancedReactFlowDiagram.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,13 @@ const TitleContainer = styled.div`
2626
h3 {
2727
font-size: 1.5rem;
2828
margin-bottom: 0.5rem;
29-
color: ${({ theme }) => theme.colors?.text?.primary || '#333'};
29+
color: ${({ theme }) => theme.colors.text.primary || '#333'};
3030
}
3131
3232
p {
3333
font-size: 1rem;
3434
line-height: 1.5;
35-
color: ${({ theme }) => theme.colors?.text?.secondary || '#666'};
35+
color: ${({ theme }) => theme.colors.text.secondary || '#666'};
3636
}
3737
`;
3838

src/shared-components/molecules/ReactFlowDiagram/ReactFlowClientWrapper.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ const LoadingContainer = styled.div`
1313
align-items: center;
1414
border: 1px dashed #ccc;
1515
border-radius: 8px;
16-
background-color: ${({ theme }) => theme.colors?.background?.light || '#f8f8f8'};
17-
color: ${({ theme }) => theme.colors?.text?.secondary || '#666'};
16+
background-color: ${({ theme }) => theme.colors.background.light || '#f8f8f8'};
17+
color: ${({ theme }) => theme.colors.text.secondary || '#666'};
1818
`;
1919

2020
const WrapperContainer = styled.div`

src/shared-components/organisms/DebtAnalysis/DebtAnalysis.styles.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ export const CardsContainer = styled.div`
4242
export const Card = styled.div<CardProps>`
4343
border-radius: 12px;
4444
overflow: hidden;
45-
box-shadow: ${({ theme }) => theme.shadows.medium};
45+
box-shadow: ${({ theme }) => theme.shadows.md};
4646
height: 100%;
4747
display: flex;
4848
flex-direction: column;
4949
transition: transform 0.3s ease, box-shadow 0.3s ease;
5050
5151
&:hover {
5252
transform: translateY(-5px);
53-
box-shadow: ${({ theme }) => theme.shadows.large};
53+
box-shadow: ${({ theme }) => theme.shadows.lg};
5454
}
5555
5656
${({ $style, theme }) => $style === 'gradient-cards' && css`

src/shared-components/organisms/Footer/Footer.styles.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,14 @@ const defaultColors = {
3535
};
3636

3737
// Helper function to determine if theme is dark
38-
// We check if theme.colors exists and if dark[7] color exists which is typically present in Mantine dark themes
38+
// Check if theme has a dark color property that indicates it's a dark theme
3939
const isDarkTheme = (theme: any) => {
40-
return theme.colors?.dark?.[7] === '#1A1B1E' || false;
40+
// Since we're dealing with a potentially unknown theme structure,
41+
// we need to safely check if this property exists
42+
if (theme && theme.colors && theme.colors.dark) {
43+
return theme.colors.dark[7] === '#1A1B1E';
44+
}
45+
return false;
4146
};
4247

4348
export const FooterContainer = styled.div<{

src/shared-components/organisms/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export function Header() {
170170
left: rem(8),
171171
right: rem(8),
172172
height: rem(2),
173-
background: theme.other.accentGradient,
173+
background: theme.colors?.gradient || 'linear-gradient(135deg, #2196f3 0%, #00bcd4 100%)',
174174
borderRadius: theme.radius.sm,
175175
}}
176176
/>

0 commit comments

Comments
 (0)