Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as React from 'react';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import Grid from '@mui/material/Grid';
import { useTheme } from '@mui/system';
import { useColorScheme } from '@mui/material/styles';

const whiteLogos = [
const darkModeLogos = [
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I renamed variable names to show their purpose, not what they actually are.

'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/6560628e8573c43893fe0ace_Sydney-white.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f4d520d0517ae8e8ddf13_Bern-white.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f46794c159024c1af6d44_Montreal-white.svg',
Expand All @@ -13,7 +13,7 @@ const whiteLogos = [
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f5caa77bf7d69fb78792e_Ankara-white.svg',
];

const darkLogos = [
const lightModeLogos = [
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/6560628889c3bdf1129952dc_Sydney-black.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f4d4d8b829a89976a419c_Bern-black.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f467502f091ccb929529d_Montreal-black.svg',
Expand All @@ -30,8 +30,19 @@ const logoStyle = {
};

export default function LogoCollection() {
const theme = useTheme();
const logos = theme.palette.mode === 'light' ? darkLogos : whiteLogos;
const { mode, systemMode } = useColorScheme();
let logos;
if (mode === 'system') {
if (systemMode === 'light') {
logos = lightModeLogos;
} else {
logos = darkModeLogos;
}
} else if (mode === 'light') {
logos = lightModeLogos;
} else {
logos = darkModeLogos;
}

return (
<Box id="logoCollection" sx={{ py: 4 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ import * as React from 'react';
import Box from '@mui/material/Box';
import Typography from '@mui/material/Typography';
import Grid from '@mui/material/Grid';
import { useTheme } from '@mui/system';
import { useColorScheme } from '@mui/material/styles';

const whiteLogos = [
const darkModeLogos = [
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/6560628e8573c43893fe0ace_Sydney-white.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f4d520d0517ae8e8ddf13_Bern-white.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f46794c159024c1af6d44_Montreal-white.svg',
Expand All @@ -13,7 +13,7 @@ const whiteLogos = [
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f5caa77bf7d69fb78792e_Ankara-white.svg',
];

const darkLogos = [
const lightModeLogos = [
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/6560628889c3bdf1129952dc_Sydney-black.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f4d4d8b829a89976a419c_Bern-black.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f467502f091ccb929529d_Montreal-black.svg',
Expand All @@ -30,8 +30,19 @@ const logoStyle = {
};

export default function LogoCollection() {
const theme = useTheme();
const logos = theme.palette.mode === 'light' ? darkLogos : whiteLogos;
Copy link
Member

Choose a reason for hiding this comment

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

Why this didn't work?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There are 2 issues with this code

  1. theme.palatte.mode isn't returning updated mode value when user changes theme. useColorScheme is returning correct mode, hence i used that
  2. system mode is not properly handled here.

const { mode, systemMode } = useColorScheme();
let logos;
if (mode === 'system') {
if (systemMode === 'light') {
logos = lightModeLogos;
} else {
logos = darkModeLogos;
}
} else if (mode === 'light') {
logos = lightModeLogos;
} else {
logos = darkModeLogos;
}

return (
<Box id="logoCollection" sx={{ py: 4 }}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
import Container from '@mui/material/Container';
import Grid from '@mui/material/Grid';
import { useTheme } from '@mui/system';
import { useColorScheme } from '@mui/material/styles';

const userTestimonials = [
{
Expand Down Expand Up @@ -54,7 +54,7 @@ const userTestimonials = [
},
];

const whiteLogos = [
const darkModeLogos = [
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/6560628e8573c43893fe0ace_Sydney-white.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f4d520d0517ae8e8ddf13_Bern-white.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f46794c159024c1af6d44_Montreal-white.svg',
Expand All @@ -63,7 +63,7 @@ const whiteLogos = [
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f5caa77bf7d69fb78792e_Ankara-white.svg',
];

const darkLogos = [
const lightModeLogos = [
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/6560628889c3bdf1129952dc_Sydney-black.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f4d4d8b829a89976a419c_Bern-black.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f467502f091ccb929529d_Montreal-black.svg',
Expand All @@ -78,8 +78,20 @@ const logoStyle = {
};

export default function Testimonials() {
const theme = useTheme();
const logos = theme.palette.mode === 'light' ? darkLogos : whiteLogos;
const { mode, systemMode } = useColorScheme();

let logos;
if (mode === 'system') {
if (systemMode === 'light') {
logos = lightModeLogos;
} else {
logos = darkModeLogos;
}
} else if (mode === 'light') {
logos = lightModeLogos;
} else {
logos = darkModeLogos;
}

return (
<Container
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Typography from '@mui/material/Typography';
import Box from '@mui/material/Box';
import Container from '@mui/material/Container';
import Grid from '@mui/material/Grid';
import { useTheme } from '@mui/system';
import { useColorScheme } from '@mui/material/styles';

const userTestimonials = [
{
Expand Down Expand Up @@ -54,7 +54,7 @@ const userTestimonials = [
},
];

const whiteLogos = [
const darkModeLogos = [
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/6560628e8573c43893fe0ace_Sydney-white.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f4d520d0517ae8e8ddf13_Bern-white.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f46794c159024c1af6d44_Montreal-white.svg',
Expand All @@ -63,7 +63,7 @@ const whiteLogos = [
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f5caa77bf7d69fb78792e_Ankara-white.svg',
];

const darkLogos = [
const lightModeLogos = [
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/6560628889c3bdf1129952dc_Sydney-black.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f4d4d8b829a89976a419c_Bern-black.svg',
'https://assets-global.website-files.com/61ed56ae9da9fd7e0ef0a967/655f467502f091ccb929529d_Montreal-black.svg',
Expand All @@ -78,8 +78,20 @@ const logoStyle = {
};

export default function Testimonials() {
const theme = useTheme();
const logos = theme.palette.mode === 'light' ? darkLogos : whiteLogos;
const { mode, systemMode } = useColorScheme();

let logos;
if (mode === 'system') {
if (systemMode === 'light') {
logos = lightModeLogos;
} else {
logos = darkModeLogos;
}
} else if (mode === 'light') {
logos = lightModeLogos;
} else {
logos = darkModeLogos;
}

return (
<Container
Expand Down
Loading