Skip to content

Commit

Permalink
Merge branch 'improvements'
Browse files Browse the repository at this point in the history
  • Loading branch information
hawkeye64 committed Nov 9, 2021
2 parents ff85eab + 8fa1ad0 commit c6ca204
Show file tree
Hide file tree
Showing 21 changed files with 933 additions and 324 deletions.
Binary file added icon-finder-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icon-finder.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added icon-finder2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iconexplorer.app",
"version": "0.0.1",
"version": "2.0.0",
"description": "Searchable Quasar SVG icons",
"productName": "Quasar Framework SVG icons",
"author": "Jeff Galbraith <[email protected]>",
Expand Down
Binary file modified public/favicon.ico
Binary file not shown.
Binary file added public/icon-finder-light.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/icons/favicon-128x128.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/icons/favicon-16x16.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/icons/favicon-32x32.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified public/icons/favicon-96x96.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion quasar.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,8 @@ module.exports = configure(function (ctx) {
plugins: [
'Dark',
'LoadingBar',
'Notify'
'Notify',
'Loading'
]
},

Expand Down
7 changes: 6 additions & 1 deletion src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

<script>
import { defineComponent } from 'vue'
import { provideStore } from 'assets/store.js'
export default defineComponent({
name: 'App'
name: 'App',
setup () {
provideStore()
}
})
</script>
Binary file added src/assets/profile.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
120 changes: 120 additions & 0 deletions src/assets/store.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
import { inject, provide, reactive, computed } from 'vue'
import { storeKey } from './symbols.js'

export function useStore () {
return inject(storeKey)
}

export function provideStore () {
const makeReactive = process.env.SERVER !== true ? reactive : val => val
const store = makeReactive({
importedIcons: null,
filter: '',
iconSet: null,
iconSize: '128px',
cart: {},
leftDrawerOpen: false,
rightDrawerOpen: false,
showIconDialog: false
})

/*
cart looks like this:
{
packageName: {
iconSet: {
iconName: path,
...
},
...
}
}
*/

store.addItem = function (packageName, iconSet, name, path) {
const item = store.findItem(packageName, iconSet, name)
if (!item) {
if (!store.cart[ packageName ]) store.cart[ packageName ] = {}
if (!store.cart[ packageName ][ iconSet ]) store.cart[ packageName ][ iconSet ] = {}
store.cart[ packageName ][ iconSet ][ name ] = path

return true
}
return false
}

store.removeItem = function (packageName, iconSet, name) {
if (store.cart[ packageName ]) {
if (store.cart[ packageName ][ iconSet ]) {
if (store.cart[ packageName ][ iconSet ][ name ]) {
delete store.cart[ packageName ][ iconSet ][ name ]
// should parents be removed?
if (Object.keys(store.cart[ packageName ][ iconSet ]).length === 0) {
delete store.cart[ packageName ][ iconSet ]
if (Object.keys(store.cart[ packageName ]).length === 0) {
delete store.cart[ packageName ]
}
}
return true
}
}
}
return false
}

store.removeAll = function () {
const keys = Object.keys(store.cart)
for (let index = 0; index < keys.length; ++index) {
delete store.cart[ keys[ index ] ]
}
}

// returns store item or null
store.findItem = function (packageName, iconSet, name) {
if (store.cart[ packageName ]) {
if (store.cart[ packageName ][ iconSet ]) {
if (store.cart[ packageName ][ iconSet ][ name ]) {
return store.cart[ packageName ][ iconSet ][ name ]
}
}
}

return null // not found
}

// When not SSR, this becomes reactive (when injected into store)
// but, on server, it's not reactive and need '.value' when accessing it
// should not be a problem because adding/removing from the cart is user initiated
store.selectedIconsFlattened = computed(() => {
const icons = [];
for (const packageName in store.cart) {
for (const iconSet in store.cart[ packageName ]) {
for (const iconName in store.cart[ packageName ][ iconSet ]) {
const path = store.cart[ packageName ][ iconSet ][ iconName ]
icons.push({
packageName,
iconSet,
iconName,
path
})
}
}
}

return icons
})

store.isCartIcon = function (name) {
for (let index = 0; index < store.selectedIconsFlattened.length; ++index) {
if (store.selectedIconsFlattened[ index ].iconName === name) {
return true
}
}
return false
}

provide(
storeKey,
store
)
}
6 changes: 6 additions & 0 deletions src/assets/symbols.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
const hasSymbol = typeof Symbol === 'function'
&& typeof Symbol.toStringTag === 'symbol'

export const storeKey = hasSymbol === true
? Symbol('_store_')
: '_store_'
84 changes: 84 additions & 0 deletions src/components/SvgIconViewer.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<template>
<div class="row justify-center">
<q-intersection
v-for="(path, name) in icons"
:key="name"
once
class="intersetion-icon-box col-xl-1 col-lg-2 col-md-3 col-sm-4 col-xs-6"
@click="onClick({ path, name })"
>
<div
class="intersetion-icon-box--inner row full-width justify-center items-center overflow-hidden ellipsis"
:class="{
'active-icon': isActiveIcon(name),
'cart-icon': store.isCartIcon(name)
}"
>
<q-icon
:name="path"
size="60px"
class="q-pa-xs row full-width justify-center items-center"
/>
<div
class="row full-width justify-center items-center ellipsis"
style="font-size: 10px;"
>
{{ name }}
</div>
<q-tooltip
:delay="250"
class="primary"
style="font-size: 24px;"
>
{{ name }}
</q-tooltip>
</div>
</q-intersection>
</div>
</template>

<script>
import { defineComponent } from 'vue'
import { useStore } from 'assets/store.js'
export default defineComponent({
name: 'SvgIconViewer',
props: {
icons: {
type: Object,
required: true
},
selectedName: {
type: String,
required: true
}
},
emits: [
'selected'
],
setup (props, { emit }) {
const store = useStore()
return {
store,
onClick: function ({ path, name }) {
emit('selected', { path, name })
},
isActiveIcon: function (name) {
return props.selectedName === name
}
}
}
})
</script>

<style lang="sass">
.active-icon
color: rgba(25, 118, 210, 0.65)
.cart-icon
color: rgba(255, 0, 0, 0.65)
</style>
3 changes: 3 additions & 0 deletions src/css/app.sass
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
// app global css in Sass form
.font-mono
font-family: ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace

.intersetion-icon-box
padding: 2px
width: 100%
Expand Down
6 changes: 3 additions & 3 deletions src/index.template.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
<meta name="title" content="Quasar SVG Icon Explorer - Explorer Quasar Framework SVG icons" data-qmeta="title">
<meta property="og:title" content="Quasar SVG Icon Explorer - Explorer Quasar Framework SVG icons" data-qmeta="ogTitle">
<meta name="twitter:title" content="Quasar SVG Icon Explorer - Explorer Quasar Framework SVG icons" data-qmeta="twitterTitle">
<meta name="description" content="An all-in-one location to search for SVG icons, copy selected icons to the clipboard, see what they look like with different foreground and background colors." data-qmeta="description">
<meta property="og:description" content="An all-in-one location to search for SVG icons, copy selected icons to the clipboard, see what they look like with different foreground and background colors." data-qmeta="ogDesc">
<meta name="twitter:description" content="An all-in-one location to search for SVG icons, copy selected icons to the clipboard, see what they look like with different foreground and background colors." data-qmeta="twitterDesc">
<meta name="description" content="An all-in-one location to search for SVG icons, copy selected icons to the clipboard, copy imports and inlined to the clipboard, plus more to come." data-qmeta="description">
<meta property="og:description" content="An all-in-one location to search for SVG icons, copy selected icons to the clipboard, copy imports and inlined to the clipboard, plus more to come." data-qmeta="ogDesc">
<meta name="twitter:description" content="An all-in-one location to search for SVG icons, copy selected icons to the clipboard, copy imports and inlined to the clipboard, plus more to come." data-qmeta="twitterDesc">

</head>
<body>
Expand Down
Loading

0 comments on commit c6ca204

Please sign in to comment.