Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
D
default2
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yuri Bondarenko
default2
Commits
3c937376
Commit
3c937376
authored
Dec 09, 2018
by
Yuri Bondarenko
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swiper
parent
fd3d5ff7
Changes
13
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
12463 additions
and
10669 deletions
+12463
-10669
.eslintrc.json
.eslintrc.json
+1
-1
package-lock.json
package-lock.json
+12270
-10636
package.json
package.json
+16
-16
src/assets/css/app.css
src/assets/css/app.css
+2
-1
src/assets/js/app.js
src/assets/js/app.js
+4
-5
src/components/component/index.js
src/components/component/index.js
+2
-3
src/components/header/index.js
src/components/header/index.js
+18
-6
src/components/swiper/index.html
src/components/swiper/index.html
+17
-0
src/components/swiper/index.js
src/components/swiper/index.js
+118
-0
src/components/swiper/swiper.css
src/components/swiper/swiper.css
+8
-0
src/index.html
src/index.html
+1
-1
webpack.dev.js
webpack.dev.js
+3
-0
webpack.prod.js
webpack.prod.js
+3
-0
No files found.
.eslintrc.json
View file @
3c937376
{
{
"parserOptions"
:
{
"parserOptions"
:
{
"ecmaVersion"
:
6
,
"ecmaVersion"
:
7
,
"sourceType"
:
"module"
,
"sourceType"
:
"module"
,
"ecmaFeatures"
:
{
"ecmaFeatures"
:
{
...
...
package-lock.json
View file @
3c937376
This source diff could not be displayed because it is too large. You can
view the blob
instead.
package.json
View file @
3c937376
{
{
"name"
:
"
bndby
"
,
"name"
:
"
default2
"
,
"version"
:
"2.0.0"
,
"version"
:
"2.0.0"
,
"description"
:
"bnd.by site"
,
"description"
:
"Default frontend project"
,
"repository"
:
{
"type"
:
"git"
,
"url"
:
"
https://github.com/bndby/bndby.git
"
},
"author"
:
"Bondarenko Yura"
,
"author"
:
"Bondarenko Yura"
,
"license"
:
"
ISC
"
,
"license"
:
"
ISC
"
,
"homepage"
:
"
https://bnd.by/
"
,
"homepage"
:
"
https://bnd.by/
"
,
"devDependencies"
:
{
"devDependencies"
:
{
"
@babel/core
"
:
"
^7.1.0
"
,
"
@babel/core
"
:
"
^7.2.0
"
,
"
@babel/preset-env
"
:
"
^7.1.0
"
,
"
@babel/plugin-proposal-class-properties
"
:
"
^7.2.1
"
,
"
autoprefixer
"
:
"
^8.2.0
"
,
"
@babel/preset-env
"
:
"
^7.2.0
"
,
"
babel-loader
"
:
"
^8.0.2
"
,
"
autoprefixer
"
:
"
^9.4.2
"
,
"
browser-sync
"
:
"
^2.24.4
"
,
"
babel-loader
"
:
"
^8.0.4
"
,
"
eslint
"
:
"
^4.19.1
"
,
"
browser-sync
"
:
"
^2.26.3
"
,
"
eslint
"
:
"
^5.10.0
"
,
"
gulp
"
:
"
^3.9.1
"
,
"
gulp
"
:
"
^3.9.1
"
,
"
gulp-cache
"
:
"
^1.0.2
"
,
"
gulp-cache
"
:
"
^1.0.2
"
,
"
gulp-clean
"
:
"
^0.4.0
"
,
"
gulp-clean
"
:
"
^0.4.0
"
,
"
gulp-concat
"
:
"
^2.6.1
"
,
"
gulp-concat
"
:
"
^2.6.1
"
,
"
gulp-cssimport
"
:
"
^7.0.0
"
,
"
gulp-cssimport
"
:
"
^7.0.0
"
,
"
gulp-file-include
"
:
"
^2.0.1
"
,
"
gulp-file-include
"
:
"
^2.0.1
"
,
"
gulp-image
"
:
"
^4.
3.0
"
,
"
gulp-image
"
:
"
^4.
4.1
"
,
"
gulp-postcss
"
:
"
^
7.0.1
"
,
"
gulp-postcss
"
:
"
^
8.0.0
"
,
"
gulp-rename
"
:
"
^1.4.0
"
,
"
gulp-rename
"
:
"
^1.4.0
"
,
"
gulp-sftp
"
:
"
^0.1.5
"
,
"
gulp-sftp
"
:
"
^0.1.5
"
,
"
gulp-sourcemaps
"
:
"
^2.6.4
"
,
"
gulp-sourcemaps
"
:
"
^2.6.4
"
,
...
@@ -32,7 +29,10 @@
...
@@ -32,7 +29,10 @@
"
postcss-import
"
:
"
^12.0.1
"
,
"
postcss-import
"
:
"
^12.0.1
"
,
"
postcss-preset-env
"
:
"
^6.4.0
"
,
"
postcss-preset-env
"
:
"
^6.4.0
"
,
"
pump
"
:
"
^3.0.0
"
,
"
pump
"
:
"
^3.0.0
"
,
"
stylelint
"
:
"
^9.2.0
"
,
"
stylelint
"
:
"
^9.9.0
"
,
"
webpack-stream
"
:
"
^5.1.1
"
"
webpack-stream
"
:
"
^5.2.1
"
},
"dependencies"
:
{
"
swiper
"
:
"
^4.4.2
"
}
}
}
}
src/assets/css/app.css
View file @
3c937376
...
@@ -2,5 +2,6 @@
...
@@ -2,5 +2,6 @@
* Базовый CSS
* Базовый CSS
*/
*/
@import
url( '../../../node_modules/swiper/dist/css/swiper.min.css' )
;
@import
url('../../components/common/common.css')
;
@import
url('../../components/common/common.css')
;
@import
url('../../components/
button/button
.css')
;
@import
url('../../components/
swiper/swiper
.css')
;
src/assets/js/app.js
View file @
3c937376
import
Button
from
'
../../components/head
er
'
;
import
SwiperSlider
from
'
../../components/swip
er
'
;
const
button
=
new
Button
();
document
.
addEventListener
(
'
DOMContentLoaded
'
,
()
=>
{
button
.
buttonAlert
();
const
swiperSlider
=
new
SwiperSlider
();
});
// Comment
\ No newline at end of file
\ No newline at end of file
src/components/component/index.js
View file @
3c937376
...
@@ -15,8 +15,7 @@ export default class Component {
...
@@ -15,8 +15,7 @@ export default class Component {
* selectors - селекторы перерисовываемых данных
* selectors - селекторы перерисовываемых данных
*/
*/
this
.
props
=
{
this
.
props
=
{
scopeSelector
:
''
,
selectors
:
[]
};
};
// объединяем с переданными параметрами
// объединяем с переданными параметрами
...
@@ -43,6 +42,6 @@ export default class Component {
...
@@ -43,6 +42,6 @@ export default class Component {
* обновляем компонент
* обновляем компонент
*/
*/
render
(){
render
(){
return
false
;
}
}
}
}
\ No newline at end of file
src/components/header/index.js
View file @
3c937376
export
default
class
Header
{
import
Component
from
'
../component
'
;
buttonAlert
()
{
export
default
class
Header
extends
Component
{
const
button
=
document
.
querySelector
(
'
.button
'
);
button
.
addEventListener
(
'
click
'
,
()
=>
{
constructor
(
props
=
{
alert
(
`Message from button:
${
button
.
innerHTML
}
`
);
buttonSelector
:
'
.header .button
'
});
}
){
super
(
props
);
this
.
state
.
button
=
document
.
querySelector
(
this
.
props
.
buttonSelector
);
this
.
state
.
button
.
addEventListener
(
'
click
'
,
this
.
buttonClick
);
}
buttonClick
(){
alert
(
1
);
}
render
(){
return
true
;
}
}
}
}
\ No newline at end of file
src/components/swiper/index.html
0 → 100644
View file @
3c937376
<!-- Slider main container -->
<div
class=
"swiper-container"
>
<!-- Additional required wrapper -->
<div
class=
"swiper-wrapper"
></div>
<!-- If we need pagination -->
<div
class=
"swiper-pagination"
></div>
<!-- If we need navigation buttons -->
<div
class=
"swiper-button-prev"
></div>
<div
class=
"swiper-button-next"
></div>
<!-- If we need scrollbar -->
<div
class=
"swiper-scrollbar"
></div>
</div>
\ No newline at end of file
src/components/swiper/index.js
0 → 100644
View file @
3c937376
import
Component
from
'
../component
'
;
import
Swiper
from
'
swiper
'
;
export
default
class
SwiperSlider
extends
Component
{
/**
* Инициализируем свайпер
* @param {object} props параметры свайпера
*/
constructor
(
props
=
{
selector
:
'
.swiper-container
'
,
options
:
{
// Optional parameters
// direction: 'vertical',
loop
:
true
,
// If we need pagination
pagination
:
{
el
:
'
.swiper-pagination
'
,
},
// Navigation arrows
navigation
:
{
nextEl
:
'
.swiper-button-next
'
,
prevEl
:
'
.swiper-button-prev
'
,
},
// And if we need scrollbar
scrollbar
:
{
el
:
'
.swiper-scrollbar
'
,
},
slidesPerView
:
1
}
}
){
super
(
props
);
this
.
state
.
swiper
=
new
Swiper
(
this
.
props
.
selector
,
this
.
props
.
options
);
this
.
loadData
(
this
.
state
);
}
/**
* загружаем данные
*/
loadData
=
()
=>
{
fetch
(
'
https://moscowseasons.com/graphql
'
,
{
method
:
'
POST
'
,
headers
:
{
'
Content-Type
'
:
'
application/json
'
},
body
:
JSON
.
stringify
({
'
operationName
'
:
'
albums
'
,
'
variables
'
:
{
'
after
'
:
null
,
'
before
'
:
null
,
'
first
'
:
4
,
'
last
'
:
null
,
'
locale
'
:
'
RU
'
},
'
query
'
:
`query albums($locale: Locale, $after: String, $first: Int, $before: String, $last: Int) {
albums(locale: $locale, after: $after, first: $first, before: $before, last: $last) {
edges {
node {
id
title
photos {
id
url
resized(width: 1200, height: 800) {
url
__typename
}
__typename
}
count
__typename
}
__typename
}
pageInfo {
hasNextPage
startCursor
endCursor
__typename
}
__typename
}
}`
})
})
.
then
(
(
response
)
=>
{
return
response
.
json
();
})
.
then
(
(
data
)
=>
{
data
.
data
.
albums
.
edges
.
forEach
(
(
album
,
index
)
=>
{
const
slide
=
`<div class="swiper-item">
<h3>Swiper
${
index
}
</h3>
<p>Swiper
${
index
}
slide</p>
<img src="
${
album
.
node
.
photos
[
0
].
resized
.
url
}
" alt="
${
album
.
node
.
title
}
" />
</div>`
;
this
.
state
.
swiper
.
appendSlide
(
slide
);
});
this
.
state
.
swiper
.
update
();
console
.
log
(
this
.
state
.
swiper
)
});
}
}
\ No newline at end of file
src/components/swiper/swiper.css
0 → 100644
View file @
3c937376
.swiper-container
{
width
:
600px
;
height
:
300px
;
}
.swiper-item
img
{
width
:
100%
;
}
\ No newline at end of file
src/index.html
View file @
3c937376
...
@@ -14,7 +14,7 @@
...
@@ -14,7 +14,7 @@
<body>
<body>
@@include( './components/
head
er/index.html' )
@@include( './components/
swip
er/index.html' )
<script
src=
"https://cdn.polyfill.io/v2/polyfill.js?features=es6,fetch"
></script>
<script
src=
"https://cdn.polyfill.io/v2/polyfill.js?features=es6,fetch"
></script>
<script
src=
"/assets/js/app.js?@@rev"
type=
"module"
></script>
<script
src=
"/assets/js/app.js?@@rev"
type=
"module"
></script>
...
...
webpack.dev.js
View file @
3c937376
...
@@ -24,6 +24,9 @@ module.exports = {
...
@@ -24,6 +24,9 @@ module.exports = {
[
'
@babel/preset-env
'
,
{
[
'
@babel/preset-env
'
,
{
useBuiltIns
:
'
usage
'
useBuiltIns
:
'
usage
'
}
]
}
]
],
'
plugins
'
:
[
'
@babel/plugin-proposal-class-properties
'
,
]
]
}
}
}
}
...
...
webpack.prod.js
View file @
3c937376
...
@@ -24,6 +24,9 @@ module.exports = {
...
@@ -24,6 +24,9 @@ module.exports = {
[
'
@babel/preset-env
'
,
{
[
'
@babel/preset-env
'
,
{
useBuiltIns
:
'
usage
'
useBuiltIns
:
'
usage
'
}
]
}
]
],
'
plugins
'
:
[
'
@babel/plugin-proposal-class-properties
'
,
]
]
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment