Skip to content

Commit d2a5031

Browse files
committed
chore(ui-codemods): make local themes default
1 parent 4e9f486 commit d2a5031

15 files changed

+630
-14
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @ts-nocheck
2+
3+
import canvasHighContrast from '@instructure/ui-themes'
4+
5+
function asd() {
6+
canvasHighContrast.use()
7+
8+
return <div>asd</div>
9+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
'Found canvasHighContrast.use(). This will be deleted. Users should wrap each React root in its own InstUISettingsProvider instead.'
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// @ts-nocheck
2+
3+
import canvas from '@instructure/ui-themes'
4+
5+
function asd() {
6+
canvas.use()
7+
8+
return <div>asd</div>
9+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
'Found canvas.use(). This will be deleted. Users should wrap each React root in its own InstUISettingsProvider instead.'
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// @ts-nocheck
2+
3+
import { ThemeRegistry } from '@instructure/theme-registry'
4+
5+
function asd() {
6+
return <div>asd</div>
7+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
'ThemeRegistry has been deleted and there are no global themes anymore.'
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// @ts-nocheck
2+
3+
import {
4+
canvasThemeLocal,
5+
canvasHighContrastThemeLocal,
6+
somethingElse
7+
} from '@instructure/ui-themes'
8+
import { canvasThemeLocal as theme } from '@instructure/ui-themes'
9+
import { canvasHighContrastThemeLocal as anotherTheme } from '@instructure/ui-themes'
10+
import * as myThemes from '@instructure/canvas-theme'
11+
12+
function asd() {
13+
const a = canvasThemeLocal
14+
const b = canvasHighContrastThemeLocal
15+
const c = canvasThemeLocalCustom
16+
const d = myThemes.canvasThemeLocal
17+
const e = myThemes.canvasHighContrastThemeLocal
18+
19+
canvasThemeLocal()
20+
canvasHighContrastThemeLocal()
21+
22+
const { canvasThemeLocal } = myThemes
23+
const { canvasHighContrastThemeLocal } = myThemes
24+
25+
return (
26+
<div>
27+
<InstUISettingsProvider theme={canvasThemeLocal}>
28+
<div>asd</div>
29+
</InstUISettingsProvider>
30+
<InstUISettingsProvider
31+
theme={{
32+
...canvasThemeLocal,
33+
...{
34+
typography: { fontFamily: 'monospace' }
35+
}
36+
}}
37+
>
38+
<div>asd</div>
39+
</InstUISettingsProvider>
40+
<InstUISettingsProvider theme={canvasHighContrastThemeLocal}>
41+
<div>asd</div>
42+
</InstUISettingsProvider>
43+
<InstUISettingsProvider
44+
theme={{
45+
...canvasHighContrastThemeLocal,
46+
...{
47+
typography: { fontFamily: 'monospace' }
48+
}
49+
}}
50+
>
51+
<div>asd</div>
52+
</InstUISettingsProvider>
53+
</div>
54+
)
55+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
// @ts-nocheck
2+
3+
import {
4+
canvasTheme,
5+
canvasHighContrastTheme,
6+
somethingElse
7+
} from '@instructure/ui-themes'
8+
import { canvasTheme as theme } from '@instructure/ui-themes'
9+
import { canvasHighContrastTheme as anotherTheme } from '@instructure/ui-themes'
10+
import * as myThemes from '@instructure/canvas-theme'
11+
12+
function asd() {
13+
const a = canvasTheme
14+
const b = canvasHighContrastTheme
15+
const c = canvasThemeLocalCustom
16+
const d = myThemes.canvasTheme
17+
const e = myThemes.canvasHighContrastTheme
18+
19+
canvasTheme()
20+
canvasHighContrastTheme()
21+
22+
const { canvasTheme } = myThemes
23+
const { canvasHighContrastTheme } = myThemes
24+
25+
return (
26+
<div>
27+
<InstUISettingsProvider theme={canvasTheme}>
28+
<div>asd</div>
29+
</InstUISettingsProvider>
30+
<InstUISettingsProvider
31+
theme={{
32+
...canvasTheme,
33+
...{
34+
typography: { fontFamily: 'monospace' }
35+
}
36+
}}
37+
>
38+
<div>asd</div>
39+
</InstUISettingsProvider>
40+
<InstUISettingsProvider theme={canvasHighContrastTheme}>
41+
<div>asd</div>
42+
</InstUISettingsProvider>
43+
<InstUISettingsProvider
44+
theme={{
45+
...canvasHighContrastTheme,
46+
...{
47+
typography: { fontFamily: 'monospace' }
48+
}
49+
}}
50+
>
51+
<div>asd</div>
52+
</InstUISettingsProvider>
53+
</div>
54+
)
55+
}

0 commit comments

Comments
 (0)