-
Notifications
You must be signed in to change notification settings - Fork 184
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #218 from gigabo/root-attributes
Update root container attributes on `reuseDom` client transition
- Loading branch information
Showing
3 changed files
with
40 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import {RootContainer, RootElement, Link} from "react-server"; | ||
|
||
const url = color => `/root/attributes?color=${color}`; | ||
|
||
const Links = opts => <span> | ||
<Link path={url( "red" )} {...opts}>Red</ Link><span> | </span> | ||
<Link path={url( "yellow" )} {...opts}>Yellow</ Link><span> | </span> | ||
<Link path={url( "green" )} {...opts}>Green</ Link> | ||
</span> | ||
|
||
export default class RootAttributesPage { | ||
getElements() { | ||
const color = this.getRequest().getQuery().color || "white"; | ||
const style = `background-color: ${color}`; | ||
return <RootContainer> | ||
<div>Background below the hr should be <em>{color}</em></div> | ||
<div><Links /> (normal)</div> | ||
<div><Links reuseDom={true}/> (reuseDom)</div> | ||
<hr /> | ||
<RootContainer style={style}> | ||
<div>RootContainer</div> | ||
</RootContainer> | ||
<RootElement style={style}> | ||
<div>RootElement</div> | ||
</RootElement> | ||
</RootContainer> | ||
} | ||
} |
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