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
2 changes: 1 addition & 1 deletion src/components/CompareResults/OverTimeResultsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function ResultsView(props: ResultsViewProps) {
}),
};

const sectionStyles = SearchContainerStyles(themeMode, /* isHome */ false);
const sectionStyles = SearchContainerStyles(/* isHome */ false);

useEffect(() => {
document.title = title;
Expand Down
2 changes: 1 addition & 1 deletion src/components/CompareResults/ResultsView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ function ResultsView(props: ResultsViewProps) {
}),
};

const sectionStyles = SearchContainerStyles(themeMode, /* isHome */ false);
const sectionStyles = SearchContainerStyles(/* isHome */ false);

useEffect(() => {
document.title = title;
Expand Down
4 changes: 1 addition & 3 deletions src/components/Search/SearchContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ import CompareWithBase from './CompareWithBase';
import type { LoaderReturnValue } from './loader';
import SearchFormHeader from './SearchFormHeader';
import { STUDENT_T } from '../../common/constants';
import { useAppSelector } from '../../hooks/app';
import { Strings } from '../../resources/Strings';
import { SearchContainerStyles } from '../../styles';
import type { TimeRange } from '../../types/types';

const strings = Strings.components.searchDefault;

function SearchContainer(props: SearchViewProps) {
const themeMode = useAppSelector((state) => state.theme.mode);
const styles = SearchContainerStyles(themeMode, /* isHome */ true);
const styles = SearchContainerStyles(/* isHome */ true);
const [isBaseSearchExpanded, setIsBaseSearchExpanded] = useState(true);
const { newRevInfo, newRepo, frameworkId } =
useLoaderData<LoaderReturnValue>();
Expand Down
2 changes: 1 addition & 1 deletion src/components/Shared/PageError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function PageError({ title }: PageErrorProps) {
}),
};

const sectionStyles = SearchContainerStyles(themeMode, /* isHome */ false);
const sectionStyles = SearchContainerStyles(/* isHome */ false);

const error = useRouteError() as Error;
console.error(error);
Expand Down
4 changes: 1 addition & 3 deletions src/components/Shared/ToggleDarkModeButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,7 @@ function ToggleDarkMode() {
margin: 0,
$nest: {
'.toggle-text': {
...(theme === 'light'
? FontsRaw.BodyDefault
: FontsRaw.BodyDefaultDark),
...FontsRaw.BodyDefault,
margin: 0,
},
'.toggle-switch': {
Expand Down
8 changes: 3 additions & 5 deletions src/styles/CompareCards.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,12 +122,10 @@ export const CompareCardsStyles = (mode: string) => {
width: '76%',
$nest: {
'.compare-card-title': {
...(isTrueLight
? FontsRaw.HeadingDefault
: FontsRaw.HeadingDefaultDark),
...FontsRaw.HeadingDefault,
},
'.compare-card-tagline': {
...(isTrueLight ? FontsRaw.BodyDefault : FontsRaw.BodyDefaultDark),
...FontsRaw.BodyDefault,
margin: '0px',
},
},
Expand Down Expand Up @@ -166,7 +164,7 @@ export const SearchStyles = (mode: string) => {
marginBottom: `${Spacing.xSmall + 2}px`,
$nest: {
'.dropdown-select-label,.base_label': {
...(isTrueLight ? FontsRaw.BodyDefault : FontsRaw.BodyDefaultDark),
...FontsRaw.BodyDefault,
fontWeight: '600',
display: 'flex',
alignItems: 'center',
Expand Down
35 changes: 7 additions & 28 deletions src/styles/Fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,37 +59,16 @@ export const FontsRaw = {
fontSize: FontSizeRaw.Normal.fontSize,
fontFamily: 'SF Pro',
},

//DARK MODE FONTS

HeadingDefaultDark: {
...sharedFontStyles,
fontWeight: '600',
fontSize: '17px',
fontFamily: 'SF Pro',
},

HeadingXSDark: {
...sharedFontStyles,
fontSize: '24px',
fontFamily: 'Metropolis',
},

BodyDefaultDark: {
...sharedFontStyles,
fontWeight: '400',
fontSize: FontSizeRaw.Normal.fontSize,
fontFamily: 'SF Pro',
},
};

const headingDefault = style(FontsRaw.HeadingDefault);
const headingXS = style(FontsRaw.HeadingXS);
const bodyDefault = style(FontsRaw.BodyDefault);

export const Fonts = {
HeadingDefault: style(FontsRaw.HeadingDefault),
HeadingXS: style(FontsRaw.HeadingXS),
BodyDefault: style(FontsRaw.BodyDefault),
HeadingDefaultDark: style(FontsRaw.HeadingDefaultDark),
HeadingXSDark: style(FontsRaw.HeadingXSDark),
BodyDefaultDark: style(FontsRaw.BodyDefaultDark),
HeadingDefault: headingDefault,
HeadingXS: headingXS,
BodyDefault: bodyDefault,
};

export const FontSize = {
Expand Down
6 changes: 2 additions & 4 deletions src/styles/SearchContainerStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@ import { stylesheet } from 'typestyle';

import { FontsRaw, Spacing } from '../styles';

export const SearchContainerStyles = (mode: string, isHome: boolean) => {
const isTrueLight = mode == 'light';

export const SearchContainerStyles = (isHome: boolean) => {
const styles = stylesheet({
container: {
/*** maxWidth based on mozilla protocol large cards size; see https://protocol.mozilla.org/components/detail/card--large
Expand All @@ -18,7 +16,7 @@ export const SearchContainerStyles = (mode: string, isHome: boolean) => {
flexDirection: 'column',
$nest: {
'.search-default-title': {
...(isTrueLight ? FontsRaw.HeadingXS : FontsRaw.HeadingXSDark),
...FontsRaw.HeadingXS,
marginBottom: `${Spacing.xLarge + 10}px`,
textAlign: 'center',
},
Expand Down
2 changes: 1 addition & 1 deletion src/styles/SelectedRevsStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const SelectRevsStyles = (mode: string) => {
},
},
'.item-container': {
...(isTrueLight ? FontsRaw.BodyDefault : FontsRaw.BodyDefaultDark),
...FontsRaw.BodyDefault,
backgroundColor: isTrueLight
? Colors.Background200
: Colors.Background300Dark,
Expand Down