-
-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
399 additions
and
321 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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 'modern-normalize/modern-normalize.css'; | ||
|
||
:root { | ||
font-family: system-ui, sans-serif; | ||
line-height: 1.5; | ||
font-weight: 400; | ||
|
||
color-scheme: light dark; | ||
color: rgba(255, 255, 255, 0.87); | ||
background-color: #242424; | ||
|
||
font-synthesis: none; | ||
text-rendering: optimizeLegibility; | ||
-webkit-font-smoothing: antialiased; | ||
-moz-osx-font-smoothing: grayscale; | ||
-webkit-text-size-adjust: 100%; | ||
} | ||
|
||
html, | ||
body, | ||
#root, | ||
#page-view { | ||
display: flex; | ||
width: 100%; | ||
height: 100%; | ||
min-height: 100%; | ||
overflow: hidden; | ||
} |
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,44 @@ | ||
import React from 'react'; | ||
import { ReactCompareSlider, ReactCompareSliderImage } from 'react-compare-slider'; | ||
|
||
import './index.css'; | ||
|
||
function Page(): JSX.Element { | ||
return ( | ||
<div style={{ width: '100%', height: '100%', flexGrow: 1 }}> | ||
<ReactCompareSlider | ||
itemOne={ | ||
<ReactCompareSliderImage | ||
src="https://github.com/nerdyman/stuff/raw/main/libs/react-compare-slider/demo-images/sydney-opera-house-1.jpg" | ||
alt="Image one" | ||
/> | ||
} | ||
itemTwo={ | ||
<ReactCompareSliderImage | ||
src="https://github.com/nerdyman/stuff/raw/main/libs/react-compare-slider/demo-images/sydney-opera-house-2.jpg" | ||
alt="Image two" | ||
/> | ||
} | ||
style={{ width: '100%', height: '50%' }} | ||
/> | ||
<ReactCompareSlider | ||
portrait | ||
itemOne={ | ||
<ReactCompareSliderImage | ||
src="https://github.com/nerdyman/stuff/raw/main/libs/react-compare-slider/demo-images/sydney-opera-house-1.jpg" | ||
alt="Image one" | ||
/> | ||
} | ||
itemTwo={ | ||
<ReactCompareSliderImage | ||
src="https://github.com/nerdyman/stuff/raw/main/libs/react-compare-slider/demo-images/sydney-opera-house-2.jpg" | ||
alt="Image two" | ||
/> | ||
} | ||
style={{ width: '100%', height: '50%' }} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
export { Page }; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 @@ | ||
import React from 'react'; | ||
|
||
export const PageLayout: React.FC<React.PropsWithChildren> = ({ children }) => { | ||
return <React.StrictMode>{children}</React.StrictMode>; | ||
}; |
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 @@ | ||
import React from 'react'; | ||
import { hydrateRoot } from 'react-dom/client'; | ||
|
||
import { PageLayout } from './PageLayout'; | ||
|
||
export async function render(pageContext: any) { | ||
const { Page } = pageContext; | ||
hydrateRoot( | ||
document.getElementById('page-view') as HTMLElement, | ||
<PageLayout> | ||
<Page /> | ||
</PageLayout>, | ||
); | ||
} |
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,29 @@ | ||
import React from 'react'; | ||
import { renderToString } from 'react-dom/server'; | ||
import { dangerouslySkipEscape, escapeInject } from 'vite-plugin-ssr/server'; | ||
|
||
import { PageLayout } from './PageLayout'; | ||
|
||
export async function render(pageContext: any) { | ||
const { Page } = pageContext; | ||
const viewHtml = dangerouslySkipEscape( | ||
renderToString( | ||
<PageLayout> | ||
<Page /> | ||
</PageLayout>, | ||
), | ||
); | ||
|
||
return escapeInject/*html*/ `<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<link rel="icon" type="image/svg+xml" href="/vite.svg" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>React Compare Slider – Example</title> | ||
</head> | ||
<body> | ||
<div id="page-view">${viewHtml}</div> | ||
</body> | ||
</html>`; | ||
} |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,7 +1,9 @@ | ||
import react from '@vitejs/plugin-react'; | ||
import { defineConfig } from 'vite'; | ||
import ssr from 'vite-plugin-ssr/plugin'; | ||
|
||
// https://vitejs.dev/config/ | ||
export default defineConfig({ | ||
plugins: [react()], | ||
plugins: [react(), ssr()], | ||
optimizeDeps: { include: ['react/jsx-dev-runtime'] }, | ||
}); |
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
Oops, something went wrong.