gamebrary/src/components/Icon.vue

57 lines
836 B
Vue
Raw Normal View History

2020-10-08 13:55:26 -04:00
<template lang="html">
<img
:src="`static/octicons/${name}.svg`"
2020-10-13 17:38:35 -07:00
:class="{ white, animated, small, invert: nightMode }"
2020-10-08 13:55:26 -04:00
/>
</template>
<script>
2020-10-13 17:38:35 -07:00
import { mapGetters } from 'vuex';
2020-10-08 13:55:26 -04:00
export default {
props: {
name: {
type: String,
default: 'sun',
},
white: Boolean,
animated: Boolean,
small: Boolean,
},
2020-10-13 17:38:35 -07:00
computed: {
...mapGetters(['nightMode']),
},
2020-10-08 13:55:26 -04:00
};
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
@keyframes spin {
from { transform:rotate(0deg); }
to { transform:rotate(360deg); }
}
img {
&.white {
filter: invert(1);
}
2020-10-13 17:38:35 -07:00
width: 22px;
height: 22px;
2020-10-08 13:55:26 -04:00
&.small {
width: 16px;
height: 16px;
}
2020-10-13 17:38:35 -07:00
&.invert {
filter: invert(1);
}
2020-10-08 13:55:26 -04:00
&.animated {
animation: spin 500ms linear infinite;
transform:rotate(360deg);
}
}
</style>