Skip to content

Commit

Permalink
Migrate TS types to new Emotion v11 Theme implementation - See https:…
Browse files Browse the repository at this point in the history
  • Loading branch information
Vadorequest committed Jan 10, 2021
1 parent 2a3c89d commit 6cc3c7e
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/components/appBootstrap/BrowserPageBootstrap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const BrowserPageBootstrap = (props: BrowserPageBootstrapProps): JSX.Element =>
cookiesManager,
userSession,
};
const theme = useTheme<CustomerTheme>();
const theme = useTheme();
const isCypressRunning = detectCypress();
const isLightHouseRunning = detectLightHouse();

Expand Down
2 changes: 1 addition & 1 deletion src/components/pageLayouts/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const Footer: React.FunctionComponent<Props> = (props) => {
const customer: Customer = useCustomer();
const { availableLanguages } = customer;
const shouldDisplayI18nButton = availableLanguages?.length > 1;
const theme = useTheme<CustomerTheme>();
const theme = useTheme();
const {
backgroundColor,
onBackgroundColor,
Expand Down
2 changes: 1 addition & 1 deletion src/components/pageLayouts/Nav.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type Props = {};
const Nav: React.FunctionComponent<Props> = () => {
const { t } = useTranslation();
const router: NextRouter = useRouter();
const theme = useTheme<CustomerTheme>();
const theme = useTheme();
const { primaryColor, logo: logoAirtable } = theme;
const logo: AirtableAttachment = logoAirtable;
const { locale }: I18n = useI18n();
Expand Down
2 changes: 1 addition & 1 deletion src/components/pageLayouts/PreviewModeBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const PreviewModeBanner: React.FunctionComponent<Props> = (props): JSX.Element =
const { t } = useTranslation();
const {
secondaryColor, secondaryColorVariant1, onSecondaryColor,
} = useTheme<CustomerTheme>();
} = useTheme();

if (process.env.NEXT_PUBLIC_APP_STAGE === 'production') {
return null;
Expand Down
2 changes: 1 addition & 1 deletion src/components/pageLayouts/QuickPreviewBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const QuickPreviewBanner: React.FunctionComponent<Props> = (props): JSX.Element
} = props;
const {
secondaryColor, secondaryColorVariant1, onSecondaryColor,
} = useTheme<CustomerTheme>();
} = useTheme();
const { t } = useTranslation();
const router: NextRouter = useRouter();
const customer: Customer = useCustomer();
Expand Down
9 changes: 5 additions & 4 deletions src/components/svg/AnimatedTextBubble.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { css } from '@emotion/core';
import { useTheme } from 'emotion-theming';
import {
css,
useTheme,
} from '@emotion/react';
import React from 'react';
import { Theme } from '../../types/data/Theme';

const AnimatedTextBubble = props => {
const theme: Theme = useTheme();
const theme = useTheme();
const { surfaceColor } = theme;
return (
<div style={{ width: '100%', marginLeft: '20px' }}>
Expand Down
2 changes: 1 addition & 1 deletion src/components/utils/Btn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const Btn: React.FunctionComponent<Props> = (props): JSX.Element => {
transparent,
...rest
} = props;
const customerTheme = useTheme<CustomerTheme>();
const customerTheme = useTheme();
const {
color,
backgroundColor,
Expand Down
2 changes: 1 addition & 1 deletion src/components/utils/CircleBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const CircleBtn: React.FunctionComponent<Props> = (props): JSX.Element => {
transparent,
...rest
} = props;
const customerTheme = useTheme<CustomerTheme>();
const customerTheme = useTheme();
const {
color,
backgroundColor,
Expand Down
2 changes: 1 addition & 1 deletion src/components/utils/LegalContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ type Props = {
* Meant to be used to display anything that is legal-related (privacy policies, terms of use, etc.)
*/
const LegalContent: React.FunctionComponent<Props> = (props): JSX.Element => {
const theme = useTheme<CustomerTheme>();
const theme = useTheme();
const { primaryColor } = theme;
const { content} = props;

Expand Down
2 changes: 1 addition & 1 deletion src/components/utils/Stamp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const Stamp: React.FunctionComponent<Props> = (props): JSX.Element => {
children,
...rest
} = props;
const { secondaryColorVariant1, secondaryColor } = useTheme<CustomerTheme>();
const { secondaryColorVariant1, secondaryColor } = useTheme();

return (
<div
Expand Down
11 changes: 11 additions & 0 deletions src/types/emotion-theme.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { CustomerTheme } from './data/CustomerTheme';

/**
* Emotion theme used thorough the whole application.
*
* @see https://emotion.sh/docs/emotion-11#theme-type
*/
declare module '@emotion/react' {
export interface Theme extends CustomerTheme {
}
}

1 comment on commit 6cc3c7e

@github-actions
Copy link

Choose a reason for hiding this comment

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

Please sign in to comment.