Skip to content

Commit 4c46d1f

Browse files
authored
Merge pull request #49 from grafana/src/remove-deprecated
Chore: Remove deprecated theme functions/methods/types
2 parents 8a98f0c + 80ece8c commit 4c46d1f

File tree

6 files changed

+45
-50
lines changed

6 files changed

+45
-50
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@
1717
"@grafana/data": "^8.4.7",
1818
"@grafana/runtime": "^8.4.7",
1919
"@grafana/toolkit": "^8.4.7",
20-
"@grafana/tsconfig": "^1.0.0-rc1",
2120
"@grafana/ui": "^8.4.7",
21+
"@grafana/tsconfig": "1.2.0-rc1",
2222
"@types/chance": "^1.1.0",
2323
"@types/memoize-one": "^5.1.2",
2424
"@types/react-calendar": "^3.1.2",

src/components/DataLinks/DataLinks.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import React from 'react';
22
import { css } from '@emotion/css';
3-
import { Button, stylesFactory, useTheme } from '@grafana/ui';
3+
import { Button, useTheme2 } from '@grafana/ui';
44
import {
5-
GrafanaTheme,
5+
GrafanaTheme2,
66
VariableOrigin,
77
DataLinkBuiltInVars,
88
} from '@grafana/data';
99
import { DataLinkConfig } from './types';
1010
import { DataLink } from './DataLink';
1111

12-
const getStyles = stylesFactory((theme: GrafanaTheme) => ({
12+
const getStyles = ((theme: GrafanaTheme2) => ({
1313
infoText: css`
14-
padding-bottom: ${theme.spacing.md};
15-
color: ${theme.colors.textWeak};
14+
padding-bottom: ${theme.v1.spacing.md};
15+
color: ${theme.v1.colors.textWeak};
1616
`,
1717
dataLink: css`
18-
margin-bottom: ${theme.spacing.sm};
18+
margin-bottom: ${theme.v1.spacing.sm};
1919
`,
2020
}));
2121

@@ -25,7 +25,7 @@ type Props = {
2525
};
2626
export const DataLinks = (props: Props) => {
2727
const { value, onChange } = props;
28-
const theme = useTheme();
28+
const theme = useTheme2();
2929
const styles = getStyles(theme);
3030

3131
return (

src/components/DatePicker/DatePicker.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, { memo } from 'react';
22
import Calendar from 'react-calendar';
3-
import { useTheme, ClickOutsideWrapper, Icon } from '@grafana/ui';
3+
import { useTheme2, ClickOutsideWrapper, Icon } from '@grafana/ui';
44
import { getStyles, getBodyStyles } from './styles';
55

66
export interface DatePickerProps {
@@ -11,7 +11,7 @@ export interface DatePickerProps {
1111
}
1212

1313
export const DatePicker = memo<DatePickerProps>((props) => {
14-
const theme = useTheme();
14+
const theme = useTheme2();
1515
const styles = getStyles(theme);
1616
const { isOpen, onClose } = props;
1717

@@ -33,7 +33,7 @@ export const DatePicker = memo<DatePickerProps>((props) => {
3333
});
3434

3535
const Body = memo<DatePickerProps>(({ value, onChange }) => {
36-
const theme = useTheme();
36+
const theme = useTheme2();
3737
const styles = getBodyStyles(theme);
3838

3939
return (

src/components/DatePicker/styles.ts

+26-26
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
1-
import { GrafanaTheme } from '@grafana/data';
1+
import { GrafanaTheme2 } from '@grafana/data';
22
import { css } from '@emotion/css';
33

4-
export const getStyles = ((theme: GrafanaTheme) => {
4+
export const getStyles = ((theme: GrafanaTheme2) => {
55
const containerBorder = theme.isDark
6-
? theme.palette.dark9
7-
: theme.palette.gray5;
6+
? theme.v1.palette.dark9
7+
: theme.v1.palette.gray5;
88

99
return {
1010
container: css`
1111
top: -1px;
1212
position: absolute;
1313
right: 544px;
14-
box-shadow: 0px 0px 20px ${theme.colors.dropdownShadow};
15-
background-color: ${theme.colors.bodyBg};
14+
box-shadow: 0px 0px 20px ${theme.v1.colors.dropdownShadow};
15+
background-color: ${theme.v1.colors.bodyBg};
1616
z-index: -1;
1717
border: 1px solid ${containerBorder};
1818
border-radius: 2px 0 0 2px;
1919
2020
&:after {
2121
display: block;
22-
background-color: ${theme.colors.bodyBg};
22+
background-color: ${theme.v1.colors.bodyBg};
2323
width: 19px;
2424
height: 100%;
2525
content: '';
2626
position: absolute;
2727
top: 0;
2828
right: -19px;
29-
border-left: 1px solid ${theme.colors.border1};
29+
border-left: 1px solid ${theme.v1.colors.border1};
3030
}
3131
`,
3232
modal: css`
33-
z-index: ${theme.zIndex.modal};
33+
z-index: ${theme.v1.zIndex.modal};
3434
`,
3535
content: css`
3636
margin: 0 auto;
@@ -44,22 +44,22 @@ export const getStyles = ((theme: GrafanaTheme) => {
4444
left: 0;
4545
background: #202226;
4646
opacity: 0.7;
47-
z-index: ${theme.zIndex.modalBackdrop};
47+
z-index: ${theme.v1.zIndex.modalBackdrop};
4848
text-align: center;
4949
`,
5050
};
5151
});
5252

53-
export const getBodyStyles = ((theme: GrafanaTheme) => {
53+
export const getBodyStyles = ((theme: GrafanaTheme2) => {
5454
const containerBorder = theme.isDark
55-
? theme.palette.dark9
56-
: theme.palette.gray5;
55+
? theme.v1.palette.dark9
56+
: theme.v1.palette.gray5;
5757

5858
return {
5959
title: css`
6060
color: ${theme.colors.text};
61-
background-color: ${theme.colors.bodyBg};
62-
font-size: ${theme.typography.size.md};
61+
background-color: ${theme.v1.colors.bodyBg};
62+
font-size: ${theme.v1.typography.size.md};
6363
border: 1px solid transparent;
6464
6565
&:hover {
@@ -69,10 +69,10 @@ export const getBodyStyles = ((theme: GrafanaTheme) => {
6969
body: css`
7070
z-index: ${theme.zIndex.modal};
7171
position: fixed;
72-
background-color: ${theme.colors.bodyBg};
72+
background-color: ${theme.v1.colors.bodyBg};
7373
width: 268px;
7474
75-
box-shadow: 0px 0px 20px ${theme.colors.dropdownShadow};
75+
box-shadow: 0px 0px 20px ${theme.v1.colors.dropdownShadow};
7676
border: 1px solid ${containerBorder};
7777
border-radius: 2px 0 0 2px;
7878
@@ -83,13 +83,13 @@ export const getBodyStyles = ((theme: GrafanaTheme) => {
8383
background-color: inherit;
8484
color: ${theme.colors.text};
8585
border: 0;
86-
font-weight: ${theme.typography.weight.semibold};
86+
font-weight: ${theme.v1.typography.weight.semibold};
8787
}
8888
8989
.react-calendar__month-view__weekdays {
9090
background-color: inherit;
9191
text-align: center;
92-
color: ${theme.palette.blue77};
92+
color: ${theme.v1.palette.blue77};
9393
9494
abbr {
9595
border: 0;
@@ -119,9 +119,9 @@ export const getBodyStyles = ((theme: GrafanaTheme) => {
119119
120120
.react-calendar__tile--active,
121121
.react-calendar__tile--active:hover {
122-
color: ${theme.palette.white};
123-
font-weight: ${theme.typography.weight.semibold};
124-
background: ${theme.palette.blue95};
122+
color: ${theme.v1.palette.white};
123+
font-weight: ${theme.v1.typography.weight.semibold};
124+
background: ${theme.v1.palette.blue95};
125125
box-shadow: none;
126126
border: 0px;
127127
}
@@ -130,12 +130,12 @@ export const getBodyStyles = ((theme: GrafanaTheme) => {
130130
.react-calendar__tile--rangeStart {
131131
padding: 0;
132132
border: 0px;
133-
color: ${theme.palette.white};
134-
font-weight: ${theme.typography.weight.semibold};
135-
background: ${theme.palette.blue95};
133+
color: ${theme.v1.palette.white};
134+
font-weight: ${theme.v1.typography.weight.semibold};
135+
background: ${theme.v1.palette.blue95};
136136
137137
abbr {
138-
background-color: ${theme.palette.blue77};
138+
background-color: ${theme.v1.palette.blue77};
139139
border-radius: 100px;
140140
display: block;
141141
padding-top: 2px;

tsconfig.json

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1+
12
{
23
"compilerOptions": {
3-
"jsx": "react",
4-
"baseUrl": "node_modules/@types",
5-
"declarationDir": "dist",
4+
"declarationDir": "dist/src",
5+
"module": "commonjs",
66
"outDir": "dist",
7-
"rootDirs": [".", "stories"],
8-
"module": "CommonJS"
7+
"rootDirs": ["."],
8+
"useUnknownInCatchVariables": false
99
},
10-
"include": ["src"],
10+
"exclude": ["dist", "node_modules"],
1111
"extends": "@grafana/tsconfig",
12-
"exclude": ["node_modules", "dist", "compiled"]
12+
"include": ["src/**/*.ts", "../../public/app/types/jquery/*.ts"]
1313
}

yarn.lock

+1-6
Original file line numberDiff line numberDiff line change
@@ -2350,12 +2350,7 @@
23502350
url-loader "^2.0.1"
23512351
webpack "4.41.5"
23522352

2353-
"@grafana/tsconfig@^1.0.0-rc1":
2354-
version "1.0.0-rc1"
2355-
resolved "https://registry.yarnpkg.com/@grafana/tsconfig/-/tsconfig-1.0.0-rc1.tgz#d07ea16755a50cae21000113f30546b61647a200"
2356-
integrity sha512-nucKPGyzlSKYSiJk5RA8GzMdVWhdYNdF+Hh65AXxjD9PlY69JKr5wANj8bVdQboag6dgg0BFKqgKPyY+YtV4Iw==
2357-
2358-
"@grafana/tsconfig@^1.2.0-rc1":
2353+
"@grafana/[email protected]", "@grafana/tsconfig@^1.2.0-rc1":
23592354
version "1.2.0-rc1"
23602355
resolved "https://registry.yarnpkg.com/@grafana/tsconfig/-/tsconfig-1.2.0-rc1.tgz#10973c978ec95b0ea637511254b5f478bce04de7"
23612356
integrity sha512-+SgQeBQ1pT6D/E3/dEdADqTrlgdIGuexUZ8EU+8KxQFKUeFeU7/3z/ayI2q/wpJ/Kr6WxBBNlrST6aOKia19Ag==

0 commit comments

Comments
 (0)