-
Notifications
You must be signed in to change notification settings - Fork 521
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update Satis UI to Bootstrap 4 (#512)
* Add Webpack configuration. * Redesign. - Uses Bootstrap 4.1 - Migrates javascript to ES6 modules and classes - Removes dependency from the massive moment.js library * Optimizes CSS file size by disabling unused Bootstrap features. * Changes the layout for the header section. Applies a more streamlined and simple layout, discarding the previous navbar-like style. * Simpler package properties markup. * Minor js tweaks. * Bugfix: there are elements with wrong markup. * Bugfix: tests were failing. * Changes license of package.json to MIT. * Remove jQuery dependency in DateDistance.js * Header redesign. - More compact initial design. - More and clearer information in the setting up info section. * Bugfix: the public path is 'build', not 'assets'.
- Loading branch information
1 parent
73d0aa4
commit 65d1f34
Showing
18 changed files
with
344 additions
and
704 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
/build/ | ||
/node_modules/ | ||
/vendor/ | ||
/.php_cs.cache | ||
/composer.phar | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
{ | ||
"devDependencies": { | ||
"@symfony/webpack-encore": "^0.20.0", | ||
"bootstrap": "^4.1.3", | ||
"date-fns": "^1.29.0", | ||
"jquery": "^3.3.1", | ||
"node-sass": "^4.9.4", | ||
"popper.js": "^1.14.3", | ||
"sass-loader": "^7.1.0" | ||
}, | ||
"license": "MIT", | ||
"private": true, | ||
"scripts": { | ||
"dev-server": "encore dev-server", | ||
"dev": "encore dev", | ||
"watch": "encore dev --watch", | ||
"build": "encore production" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
// Imports all of Bootstrap | ||
// @import '~bootstrap/scss/bootstrap'; | ||
|
||
// Imports only used Bootstrap | ||
@import "~bootstrap/scss/functions"; | ||
@import "~bootstrap/scss/variables"; | ||
@import "~bootstrap/scss/mixins"; | ||
@import "~bootstrap/scss/root"; | ||
@import "~bootstrap/scss/reboot"; | ||
@import "~bootstrap/scss/type"; | ||
// @import "~bootstrap/scss/images"; | ||
@import "~bootstrap/scss/code"; | ||
@import "~bootstrap/scss/grid"; | ||
// @import "~bootstrap/scss/tables"; | ||
@import "~bootstrap/scss/forms"; | ||
@import "~bootstrap/scss/buttons"; | ||
@import "~bootstrap/scss/transitions"; | ||
// @import "~bootstrap/scss/dropdown"; | ||
// @import "~bootstrap/scss/button-group"; | ||
// @import "~bootstrap/scss/input-group"; | ||
// @import "~bootstrap/scss/custom-forms"; | ||
// @import "~bootstrap/scss/nav"; | ||
// @import "~bootstrap/scss/navbar"; | ||
@import "~bootstrap/scss/card"; | ||
// @import "~bootstrap/scss/breadcrumb"; | ||
// @import "~bootstrap/scss/pagination"; | ||
@import "~bootstrap/scss/badge"; | ||
// @import "~bootstrap/scss/jumbotron"; | ||
// @import "~bootstrap/scss/alert"; | ||
// @import "~bootstrap/scss/progress"; | ||
// @import "~bootstrap/scss/media"; | ||
// @import "~bootstrap/scss/list-group"; | ||
// @import "~bootstrap/scss/close"; | ||
// @import "~bootstrap/scss/modal"; | ||
// @import "~bootstrap/scss/tooltip"; | ||
// @import "~bootstrap/scss/popover"; | ||
// @import "~bootstrap/scss/carousel"; | ||
@import "~bootstrap/scss/utilities"; | ||
@import "~bootstrap/scss/print"; | ||
|
||
pre.file { | ||
border-left: 2px solid $primary; | ||
background-color: $light; | ||
padding: map-get($spacers, 2); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import distanceInWordsToNow from 'date-fns/distance_in_words_to_now'; | ||
|
||
class DateDistance { | ||
static calculate(elements) { | ||
if (typeof elements === 'string') { | ||
elements = document.querySelectorAll(elements); | ||
} | ||
for (let i = 0; i < elements.length; i++) { | ||
let element = elements[i]; | ||
let datetime = element.attributes.datetime.value; | ||
let date = new Date(datetime); | ||
let distance = distanceInWordsToNow(date, { | ||
addSuffix: true | ||
}); | ||
|
||
element.textContent = distance; | ||
} | ||
} | ||
} | ||
|
||
export default DateDistance; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import $ from 'jquery'; | ||
|
||
class PackageFilter { | ||
constructor(input, list, listItem) { | ||
this.input = $(input); | ||
this.list = $(list); | ||
this.listItemSelector = listItem; | ||
this.packages = this.list.find(listItem); | ||
this.inputTimeout = null; | ||
|
||
this.readHash = this.readHash.bind(this); | ||
this.updateHash = this.updateHash.bind(this); | ||
this.filterPackages = this.filterPackages.bind(this); | ||
|
||
this.init(); | ||
} | ||
|
||
readHash() { | ||
let hash = window.decodeURIComponent(window.location.hash.substr(1)); | ||
|
||
if (hash.length > 0) { | ||
this.input.val(hash); | ||
this.filterPackages(); | ||
} | ||
}; | ||
|
||
updateHash() { | ||
window.location.hash = window.encodeURIComponent(this.input.val()); | ||
}; | ||
|
||
filterPackages() { | ||
var needle = this.input.val().toLowerCase(), | ||
closestSelector = this.listItemSelector; | ||
|
||
this.list.hide(); | ||
|
||
this.packages.each(function () { | ||
$(this).closest(closestSelector).toggle( | ||
$(this).text().toLowerCase().indexOf(needle) !== -1 | ||
); | ||
}); | ||
|
||
this.list.show(); | ||
}; | ||
|
||
init() { | ||
var instance = this; | ||
|
||
instance.input.keyup(function () { | ||
instance.updateHash(); | ||
window.clearTimeout(instance.inputTimeout); | ||
instance.inputTimeout = window.setTimeout(instance.filterPackages, 350); | ||
}); | ||
|
||
$(window).keyup(function (event) { | ||
if (event.keyCode === 27) { // "ESC" keyCode | ||
instance.input.val(''); | ||
instance.filterPackages(); | ||
} | ||
}); | ||
|
||
instance.readHash(); | ||
} | ||
} | ||
|
||
export default PackageFilter; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import $ from 'jquery'; | ||
// import 'bootstrap'; | ||
// import 'popper.js'; | ||
import 'bootstrap/js/dist/collapse'; | ||
import DateDistance from './App/DateDistance'; | ||
import PackageFilter from './App/PackageFilter'; | ||
|
||
function updateTimeElements () { | ||
DateDistance.calculate('time') | ||
}; | ||
|
||
$(document).ready(function() { | ||
new PackageFilter('input#search', '#package-list', '.card'); | ||
|
||
updateTimeElements(); | ||
window.setInterval(updateTimeElements, 5000); | ||
}); |
Oops, something went wrong.