Skip to content

Commit

Permalink
5. Get basic layout of the application set up
Browse files Browse the repository at this point in the history
  • Loading branch information
liamross committed Feb 26, 2020
1 parent 22eaec5 commit eb3a163
Show file tree
Hide file tree
Showing 8 changed files with 46 additions and 229 deletions.
48 changes: 19 additions & 29 deletions src/App.css
Original file line number Diff line number Diff line change
@@ -1,38 +1,28 @@
.App {
text-align: center;
}

.App-logo {
height: 40vmin;
pointer-events: none;
.app {
display: flex;
flex-direction: column;
height: 100%;
overflow: hidden;
background-color: var(--color-background-canvas);
}

@media (prefers-reduced-motion: no-preference) {
.App-logo {
animation: App-logo-spin infinite 20s linear;
}
.app__main {
flex: 1 1 auto;
overflow: hidden;
}

.App-header {
background-color: #282c34;
min-height: 100vh;
.app__placeholder {
height: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

.App-link {
color: #61dafb;
align-items: center;
text-align: center;
padding: var(--padding);
}

@keyframes App-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
.app__footer {
flex: 0 0;
padding: var(--padding);
border-top: 1px solid var(--color-gray-3);
background-color: var(--color-gray-1);
}
9 changes: 0 additions & 9 deletions src/App.test.tsx

This file was deleted.

27 changes: 11 additions & 16 deletions src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,19 @@
import { Button, ButtonGroup } from '@pdftron/webviewer-react-toolkit';
import React from 'react';
import logo from './logo.svg';
import './App.css';

function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.tsx</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
</header>
<div className="app">
<main className="app__main">
<div className="app__placeholder">Click Load PDF to begin organizing pages.</div>
</main>
<footer className="app__footer">
<ButtonGroup>
<Button buttonStyle="borderless">Load PDF</Button>
<Button disabled>Download PDF</Button>
</ButtonGroup>
</footer>
</div>
);
}
Expand Down
20 changes: 12 additions & 8 deletions src/index.css
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
@import '~@pdftron/webviewer-react-toolkit/dist/css/style.css';
@import url('https://fonts.googleapis.com/css?family=Lato:400,400i,700,700i&display=swap');

html,
body,
#root {
height: 100%;
}

html {
background-color: var(--color-background-canvas);
}

body {
margin: 0;
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
sans-serif;
font-family: Lato;
color: var(--color-font-primary);
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}

code {
font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
monospace;
}
10 changes: 4 additions & 6 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,9 @@ import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';

ReactDOM.render(<App />, document.getElementById('root'));
// Set the path to your Web Worker. This will be relative to your html file
// (which is in `public`) so you will need to path to `'./lib/core'`
window.CoreControls.setWorkerPath('./lib/core');

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();
ReactDOM.render(<App />, document.getElementById('root'));
7 changes: 0 additions & 7 deletions src/logo.svg

This file was deleted.

149 changes: 0 additions & 149 deletions src/serviceWorker.ts

This file was deleted.

5 changes: 0 additions & 5 deletions src/setupTests.ts

This file was deleted.

1 comment on commit eb3a163

@liamross
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step 5 - Basic Layout of Application

  1. First, we are going to set the worker path for CoreControls in src/index.tsx and remove the serviceWorker that is provided by default with Create React App (service workers can be useful, but we are removing it to simplify the demo).

    View the changes here.

  2. We are going to fix the styling of src/index.css in order to make the app mobile-friendly and to add some of the CSS variables provided by the toolkit.

    View the changes here.

  3. We can now overwrite the content of src/App.tsx to set up the basic content of the app. We are going to add some components from the toolkit, such as Button and ButtonGroup.

    View the changes here.

  4. Now that the content of App is set up, we can style it by changing src/App.css. We will use some variables from the toolkit in order to keep styling consistent.

    View the changes here.

  5. Finally, delete all the unused files that were generated by Create React App. These are src/logo.svg, src/serviceWorker.ts and src/setupTests.ts.

Please sign in to comment.