diff options
Diffstat (limited to 'server/sonar-web/src/main/js/components/theme.ts')
-rw-r--r-- | server/sonar-web/src/main/js/components/theme.ts | 65 |
1 files changed, 0 insertions, 65 deletions
diff --git a/server/sonar-web/src/main/js/components/theme.ts b/server/sonar-web/src/main/js/components/theme.ts deleted file mode 100644 index 1dabe475f62..00000000000 --- a/server/sonar-web/src/main/js/components/theme.ts +++ /dev/null @@ -1,65 +0,0 @@ -/* - * SonarQube - * Copyright (C) 2009-2021 SonarSource SA - * mailto:info AT sonarsource DOT com - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 3 of the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ -import { css, ThemeContext as EmotionThemeContext } from '@emotion/core'; -import emotionStyled, { CreateStyled } from '@emotion/styled'; -import { - ThemeProvider as EmotionThemeProvider, - ThemeProviderProps, - useTheme as emotionUseTheme, - withTheme -} from 'emotion-theming'; -import * as React from 'react'; - -export interface Theme { - colors: T.Dict<string>; - sizes: T.Dict<string>; - rawSizes: T.Dict<number>; - fonts: T.Dict<string>; - zIndexes: T.Dict<string>; - others: T.Dict<string>; -} - -export interface ThemedProps { - theme: Theme; -} - -const ThemeContext = EmotionThemeContext as React.Context<Theme>; - -export const styled = emotionStyled as CreateStyled<Theme>; -export const ThemeConsumer = ThemeContext.Consumer; -export const ThemeProvider = EmotionThemeProvider as React.ProviderExoticComponent< - ThemeProviderProps<Theme> ->; -export const useTheme = emotionUseTheme as () => Theme; - -export function themeGet(type: keyof Theme, name: string | number) { - return function({ theme }: Partial<ThemedProps>) { - return theme?.[type][name]; - }; -} -export function themeColor(name: keyof Theme['colors']) { - return themeGet('colors', name); -} -export function themeSize(name: keyof Theme['sizes']) { - return themeGet('sizes', name); -} - -export { css, withTheme }; -export default ThemeContext; |