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

Changed mode selector #948

Merged
merged 1 commit into from
Dec 19, 2024
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
4 changes: 3 additions & 1 deletion docs/src/shared/CallToActionButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
CardActionAreaProps,
SxProps,
Box,
useColorScheme,
} from '@mui/material';

type CallToActionButtonProps = {
Expand Down Expand Up @@ -63,6 +64,7 @@ const styles: { [key: string]: SxProps<Theme> } = {

export const CallToActionButton: React.FC<CallToActionButtonProps> = (props): JSX.Element => {
const theme = useTheme();
const colorScheme = useColorScheme();
const {
avatar = <DesignServices sx={{ height: 48, width: 48 }} />,
description = `Learn about Material Design's description of this pattern. Follow their guidance unless Brightlayer UI recommends specific changes.`,
Expand All @@ -73,7 +75,7 @@ export const CallToActionButton: React.FC<CallToActionButtonProps> = (props): JS
...cardProps
} = props;
return (
<Card sx={styles.root} variant={theme.palette.mode === 'light' ? 'elevation' : 'outlined'} {...cardProps}>
<Card sx={styles.root} variant={colorScheme.mode === 'light' ? 'elevation' : 'outlined'} {...cardProps}>
<CardActionArea
onClick={(e): void => {
if (e) {
Expand Down
5 changes: 2 additions & 3 deletions docs/src/shared/theme/ThemeExplorer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import { Spacer } from '@brightlayer-ui/react-components';
import { blueThemes as theme } from '@brightlayer-ui/react-themes';
import { ThemeProvider, useTheme } from '@mui/material/styles';
import { ThemeProvider } from '@mui/material/styles';
import {
Card,
Divider,
Expand All @@ -20,15 +20,14 @@ import { SystemStyleObject } from '@mui/system';

export const ThemeExplorer: React.FC = () => {
const colorScheme = useColorScheme();
const globalTheme = useTheme();
const [localThemeDark, setLocalThemeDark] = useState(colorScheme.mode === 'dark');
const [selectedComponent, setSelectedComponent] = useState(0);

return (
<ThemeProvider theme={theme}>
<Card
sx={{ mb: 4, boxSizing: 'border-box', '&:hover': { boxShadow: 6 } }}
variant={globalTheme.palette.mode === 'dark' ? 'outlined' : undefined}
variant={colorScheme.mode === 'dark' ? 'outlined' : undefined}
>
<Toolbar
sx={[
Expand Down
Loading