-
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.
Trying out some more cases with imports
- Loading branch information
Showing
7 changed files
with
222 additions
and
17 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
.next |
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,3 @@ | ||
export const blue = "#0000ff"; | ||
export const red = "#ff0000"; | ||
export const green = "#00ff00"; |
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 |
---|---|---|
@@ -1,7 +1,22 @@ | ||
import css from "styled-jsx/css"; | ||
|
||
import { blue as b } from "./colors"; | ||
import * as Colors from "./colors"; | ||
|
||
export const orange = css` | ||
.orange { | ||
color: orange; | ||
} | ||
`; | ||
|
||
export const blue = css` | ||
.blue { | ||
color: ${b}; | ||
} | ||
`; | ||
|
||
export const green = css` | ||
.green { | ||
color: ${Colors.green}; | ||
} | ||
`; |
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 |
---|---|---|
@@ -1,8 +1,94 @@ | ||
import { orange } from "../lib/styles"; | ||
import Link from "next/link"; | ||
|
||
import { orange, blue, green } from "../lib/styles"; | ||
import * as Colors from "../lib/colors"; | ||
import { blue as b } from "../lib/colors"; | ||
|
||
export default () => ( | ||
<div> | ||
PAGE 1{" "} | ||
<Link href="/two"> | ||
<a>Back to 2</a> | ||
</Link> | ||
<Orange /> | ||
<Blue /> | ||
<Green /> | ||
<Green /> | ||
<Green /> | ||
<Green /> | ||
<GreenColors /> | ||
<BlueColors /> | ||
<DoubleColors /> | ||
<Color color="gray" /> | ||
<Color color={Colors.red} /> | ||
<Color color={b} /> | ||
{["teal", "gold"].map(c => <Color key={c} color={c} />)} | ||
</div> | ||
); | ||
|
||
const Orange = () => ( | ||
<div className="orange"> | ||
Hello (i should be orange) | ||
<style jsx>{orange}</style> | ||
</div> | ||
); | ||
|
||
const Blue = () => ( | ||
<div className="blue"> | ||
Hello (i should be blue) | ||
<style jsx>{blue}</style> | ||
</div> | ||
); | ||
|
||
const Green = () => ( | ||
<div className="green"> | ||
Hello (i should be green) | ||
<style jsx>{green}</style> | ||
</div> | ||
); | ||
|
||
const GreenColors = () => ( | ||
<div className="green"> | ||
Hello (i should be green too) | ||
<style jsx>{` | ||
.green { | ||
color: ${Colors.green}; | ||
} | ||
`}</style> | ||
</div> | ||
); | ||
|
||
const BlueColors = () => ( | ||
<div className="blue"> | ||
Hello (i should be blue too) | ||
<style jsx>{` | ||
.blue { | ||
color: ${b}; | ||
} | ||
`}</style> | ||
</div> | ||
); | ||
|
||
const DoubleColors = () => ( | ||
<div className="orange z-blue"> | ||
Hello (i should be orange too but will be blue because of insertion order of | ||
the <style> tags) | ||
<style jsx>{` | ||
.z-blue { | ||
color: ${b}; | ||
} | ||
`}</style> | ||
<style jsx>{orange}</style> | ||
</div> | ||
); | ||
|
||
const Color = ({ color }) => ( | ||
<div className="color"> | ||
Hello (i should be the color: {color}) | ||
<style jsx>{` | ||
.color { | ||
color: ${color}; | ||
} | ||
`}</style> | ||
</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,94 @@ | ||
import Link from "next/link"; | ||
|
||
import { orange, blue, green } from "../lib/styles"; | ||
import * as Colors from "../lib/colors"; | ||
import { blue as b } from "../lib/colors"; | ||
|
||
export default () => ( | ||
<div> | ||
PAGE 2{" "} | ||
<Link href="/"> | ||
<a>Back to 1</a> | ||
</Link> | ||
<Orange /> | ||
<Blue /> | ||
<Green /> | ||
<Green /> | ||
<Green /> | ||
<Green /> | ||
<GreenColors /> | ||
<BlueColors /> | ||
<DoubleColors /> | ||
<Color color="gray" /> | ||
<Color color={Colors.red} /> | ||
<Color color={b} /> | ||
{["teal", "gold"].map(c => <Color key={c} color={c} />)} | ||
</div> | ||
); | ||
|
||
const Orange = () => ( | ||
<div className="orange"> | ||
Hello (i should be orange) | ||
<style jsx>{orange}</style> | ||
</div> | ||
); | ||
|
||
const Blue = () => ( | ||
<div className="blue"> | ||
Hello (i should be blue) | ||
<style jsx>{blue}</style> | ||
</div> | ||
); | ||
|
||
const Green = () => ( | ||
<div className="green"> | ||
Hello (i should be green) | ||
<style jsx>{green}</style> | ||
</div> | ||
); | ||
|
||
const GreenColors = () => ( | ||
<div className="green"> | ||
Hello (i should be green too) | ||
<style jsx>{` | ||
.green { | ||
color: ${Colors.green}; | ||
} | ||
`}</style> | ||
</div> | ||
); | ||
|
||
const BlueColors = () => ( | ||
<div className="blue"> | ||
Hello (i should be blue too) | ||
<style jsx>{` | ||
.blue { | ||
color: ${b}; | ||
} | ||
`}</style> | ||
</div> | ||
); | ||
|
||
const DoubleColors = () => ( | ||
<div className="orange z-blue"> | ||
Hello (i should be orange too but will be blue because of insertion order of | ||
the <style> tags) | ||
<style jsx>{` | ||
.z-blue { | ||
color: ${b}; | ||
} | ||
`}</style> | ||
<style jsx>{orange}</style> | ||
</div> | ||
); | ||
|
||
const Color = ({ color }) => ( | ||
<div className="color"> | ||
Hello (i should be the color: {color}) | ||
<style jsx>{` | ||
.color { | ||
color: ${color}; | ||
} | ||
`}</style> | ||
</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