Skip to content

Commit

Permalink
Merge pull request #10 from manGoweb/pr/component/in-view
Browse files Browse the repository at this point in the history
Pr/component/in view
  • Loading branch information
FilipChalupa committed Jul 16, 2019
2 parents 4738c85 + 0bb450e commit 77ae4b0
Show file tree
Hide file tree
Showing 15 changed files with 1,538 additions and 107 deletions.
3 changes: 2 additions & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
"packages": [
"packages/*",
"sass-base",
"scripts-base"
"scripts-base",
"scripts-components/*"
],
"version": "0.0.5"
}
3 changes: 2 additions & 1 deletion sass-base/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"main": "index.sass",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": ":"
"build": ":",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
Expand Down
7 changes: 4 additions & 3 deletions scripts-base/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ You can import these and use them via `initializeComponents` side by side with y

```typescript
import { Shapes } from `@mangoweb/scripts-base`
import { InView } from `@mangoweb/in-view`
```

There are currently these:
- `Emitter`
- `InView`
- `Shapes`
- Emitter
- [InView](https://www.npmjs.com/package/@mangoweb/in-view)
- Shapes
5 changes: 3 additions & 2 deletions scripts-base/package.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
{
"name": "@mangoweb/scripts-base",
"version": "0.0.9",
"description": "Simple component model for small to meduim sites. Usable from JS & TS.",
"description": "Simple component model for small to medium sites. Usable from JS & TS.",
"main": "lib/index.js",
"types": "lib/index.d.ts",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc",
"eslint:lint": "eslint \"src/**/*.{ts,tsx}\" ",
"eslint:fix": "eslint --fix \"src/**/*.{ts,tsx}\" "
"eslint:fix": "eslint --fix \"src/**/*.{ts,tsx}\" ",
"prepublish": "npm run build"
},
"repository": {
"type": "git",
Expand Down
99 changes: 0 additions & 99 deletions scripts-base/src/components/InView.ts

This file was deleted.

1 change: 0 additions & 1 deletion scripts-base/src/components/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
export * from './Emitter'
export * from './Example'
export * from './InView'
export * from './Shapes'
5 changes: 5 additions & 0 deletions scripts-components/in-view/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module.exports = {
extends: [
'@mangoweb/eslint-config-ts',
]
};
1 change: 1 addition & 0 deletions scripts-components/in-view/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lib
1 change: 1 addition & 0 deletions scripts-components/in-view/.npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tsconfig.json
3 changes: 3 additions & 0 deletions scripts-components/in-view/.prettierrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module.exports = {
...require('@mangoweb/prettier-config')
}
30 changes: 30 additions & 0 deletions scripts-components/in-view/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# InView

The manGoweb InView component. Watches elements entering and leaving viewport.

## Installation

`$ npm install @mangoweb/in-view @mangoweb/scripts-base`

This is a [`@mangoweb/scripts-base`](https://www.npmjs.com/package/@mangoweb/scripts-base) component.

## Usage

In your template:
```html
<script>
window.initComponents = (window.initComponents || []).push({
name: 'InView',
place: '#targetWrapper', // Element you want to watch or a wrapper
data: { // Optional
targets: '.target', // Watched children
threshold: 0, // Area of a target required to be inside viewport
isAboveViewClass: 'isAboveView', // Class added to a target element when seen above viewport
isInViewClass: 'isInView', // Target seen in viewport
isBelowViewClass: 'isBelowView', // Target seen below viewport
isSeenClass: 'isSeen', // Target seen in viewport at least once
}
})
</script>
```
Loading

0 comments on commit 77ae4b0

Please sign in to comment.