forked from vercel/next.js
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for jsxImportSource in tsconfig/jsconfig (vercel#31358)
- Loading branch information
1 parent
06f3d39
commit a4692d4
Showing
8 changed files
with
97 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import { join } from 'path' | ||
import webdriver from 'next-webdriver' | ||
import { createNext, FileRef } from 'e2e-utils' | ||
import { NextInstance } from 'test/lib/next-modes/base' | ||
|
||
describe('theme-ui SWC option', () => { | ||
let next: NextInstance | ||
|
||
beforeAll(async () => { | ||
next = await createNext({ | ||
files: { | ||
'jsconfig.json': new FileRef(join(__dirname, 'theme-ui/jsconfig.json')), | ||
pages: new FileRef(join(__dirname, 'theme-ui/pages')), | ||
'theme.js': new FileRef(join(__dirname, 'theme-ui/theme.js')), | ||
}, | ||
dependencies: { | ||
'theme-ui': '0.12.0', | ||
}, | ||
}) | ||
}) | ||
afterAll(() => next.destroy()) | ||
|
||
it('should have theme provided styling', async () => { | ||
let browser | ||
try { | ||
browser = await webdriver(next.appPort, '/') | ||
const color = await browser.elementByCss('#hello').getComputedCss('color') | ||
expect(color).toBe('rgb(51, 51, 238)') | ||
} finally { | ||
if (browser) { | ||
await browser.close() | ||
} | ||
} | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"compilerOptions": { | ||
"jsxImportSource": "theme-ui" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// basic usage | ||
import { ThemeProvider } from 'theme-ui' | ||
import theme from '../theme' | ||
|
||
function MyApp({ Component, pageProps }) { | ||
return ( | ||
<ThemeProvider theme={theme}> | ||
<Component {...pageProps} /> | ||
</ThemeProvider> | ||
) | ||
} | ||
|
||
export default MyApp |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
export default function Home() { | ||
return ( | ||
<div | ||
id="hello" | ||
sx={{ | ||
fontWeight: 'bold', | ||
fontSize: 4, // picks up value from `theme.fontSizes[4]` | ||
color: 'primary', // picks up value from `theme.colors.primary` | ||
}} | ||
> | ||
Hello | ||
</div> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// example theme.js | ||
export default { | ||
fonts: { | ||
body: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", sans-serif', | ||
heading: '"Avenir Next", sans-serif', | ||
monospace: 'Menlo, monospace', | ||
}, | ||
colors: { | ||
text: '#000', | ||
background: '#fff', | ||
primary: '#33e', | ||
}, | ||
} |