Skip to content

Commit 274d39d

Browse files
feat: convert SFC to normal js file
Was unnecessary because the component is functional. Also provides easier import!
1 parent 1db0dd9 commit 274d39d

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

lib/ScrollNextLevel.vue renamed to lib/index.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
<script>
21
export default {
32
functional: true,
43
render (h, { children, data, props: { target, scrollFunction }, _ssrNode }) {
5-
const clickFunction = () => { scrollFunction ? scrollFunction(target) : defaultScrollFunction(target)}
4+
const clickFunction = () => { scrollFunction ? scrollFunction(target) : defaultScrollFunction(target) }
65

76
return h('div', {
87
...data,
@@ -29,12 +28,11 @@ const defaultScrollFunction = async rawTarget => {
2928

3029
// If target prop is present but the node does not exist, send an error
3130
if (!node) {
31+
// eslint-disable-next-line no-console
3232
return console.error(`Could not scroll to ${target}`)
3333
}
3434

3535
node.scrollIntoView({
3636
behavior: 'smooth'
3737
})
3838
}
39-
40-
</script>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"description": "Bring your scroll game to the next level",
55
"author": "Alexander Lichter <[email protected]>",
66
"license": "MIT",
7-
"main": "lib/ScrollNextLevel.vue",
7+
"main": "lib/index.js",
88
"repository": {
99
"type": "git",
1010
"url": "git+https://github.com/Developmint/vue-next-level-scroll"

test/ScrollNextLevel.spec.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/* eslint-disable no-console */
22
import { mount } from '@vue/test-utils'
3-
import ScrollNextLevel from '@/ScrollNextLevel'
3+
import ScrollNextLevel from '../lib'
44
import Target from './fixtures/Target'
55
import { render } from '@vue/server-test-utils'
66
import flushPromises from 'flush-promises'

0 commit comments

Comments
 (0)