Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
timc1 committed Apr 2, 2019
1 parent d3158fe commit 7c472ad
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 44 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Expand Up @@ -21,3 +21,6 @@
npm-debug.log*
yarn-debug.log*
yarn-error.log*

*.swp
*.swo
112 changes: 68 additions & 44 deletions README.md
@@ -1,44 +1,68 @@
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.<br>
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.<br>
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.<br>
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.<br>
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.<br>
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
<h1 align="center">
React Fullscreen Images
</h1>
<p align="center" style="font-size: 1.5rem;">
A simple, fast, and beautiful fullscreen React image viewer using CSS transforms & opacity.
</p>

You've got a list of images that you want to allow users to click and expand into fullscreen mode.

React Fullscreen Images is a tiny library to render images that animate to fullscreen view when
clicked.

## Features

- Only animates transform and opacity properties.
- Keyboard event handlers (escape key, left/right arrow navigation).
- Handles outer click — anywhere outside of image when clicked will zoom image to its original
position.
- Scrolling, (with requestAnimationFrame) to a set boundary will zoom image to its original position.

<p align="center">
<img src="demo.gif" alt="demo" />
</p>

## Usage

React Fullscreen Images uses [compound components](https://kentcdodds.com/blog/compound-components-with-react-hooks). All `<Image />` components nested within an `<ImageGroup />` will be navigatable when in fullscreen mode.

```jsx
const images = [
'https://unsplash.com/photos/Bkci_8qcdvQ',
'https://unsplash.com/photos/hS46bsAASwQ',
'https://unsplash.com/photos/2VDa8bnLM8c',
'https://unsplash.com/photos/_LuLiJc1cdo',
'https://unsplash.com/photos/1Z2niiBPg5A',
'https://unsplash.com/photos/pHANr-CpbYM',
'https://unsplash.com/photos/pQMM63GE7fo',
'https://unsplash.com/photos/2VDa8bnLM8c',
'https://unsplash.com/photos/MBkQKiH14ng',
]

export default function App() {
return (
<ImageGroup>
<ul className="images">
{images.map(i => (
<li key={i}>
<Image
src={i}
alt="nature"
style={{
position: 'absolute',
top: 0,
left: 0,
right: 0,
bottom: 0,
height: '100%',
width: '100%',
objectFit: 'cover',
}}
/>
</li>
))}
</ul>
</ImageGroup>
)
}
```
Binary file added demo.gif
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 7c472ad

Please sign in to comment.