Skip to content

Commit

Permalink
Improved/fixed votetype selection (snapshot-labs#971)
Browse files Browse the repository at this point in the history
* improved/fixed votetype selection

* added alternative check icon

* increase check icon size
  • Loading branch information
mktcode authored Nov 2, 2021
1 parent 9f76361 commit d00ee76
Show file tree
Hide file tree
Showing 8 changed files with 56 additions and 14 deletions.
10 changes: 7 additions & 3 deletions src/assets/fonts/iconfont.css
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
@font-face {
font-family: "iconfont"; /* Project id 1946815 */
src: url('iconfont.woff2?t=1632986541203') format('woff2'),
url('iconfont.woff?t=1632986541203') format('woff'),
url('iconfont.ttf?t=1632986541203') format('truetype');
src: url('iconfont.woff2?t=1635879635621') format('woff2'),
url('iconfont.woff?t=1635879635621') format('woff'),
url('iconfont.ttf?t=1635879635621') format('truetype');
}

.iconfont {
Expand All @@ -13,6 +13,10 @@
-moz-osx-font-smoothing: grayscale;
}

.iconcheck1:before {
content: "\e607";
}

.iconremind:before {
content: "\e69e";
}
Expand Down
7 changes: 7 additions & 0 deletions src/assets/fonts/iconfont.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@
"css_prefix_text": "icon",
"description": "",
"glyphs": [
{
"icon_id": "583318",
"name": "check",
"font_class": "check1",
"unicode": "e607",
"unicode_decimal": 58887
},
{
"icon_id": "1410439",
"name": "notifications-none",
Expand Down
Binary file modified src/assets/fonts/iconfont.ttf
Binary file not shown.
Binary file modified src/assets/fonts/iconfont.woff
Binary file not shown.
Binary file modified src/assets/fonts/iconfont.woff2
Binary file not shown.
47 changes: 39 additions & 8 deletions src/components/Modal/VotingType.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,14 @@ defineProps({
type: Boolean,
required: true
},
selected: String
selected: String,
allowAny: {
type: Boolean,
default: false
}
});
const emit = defineEmits(['close', 'update:modelValue']);
const emit = defineEmits(['close', 'update:selected']);
const types = [
'single-choice',
Expand All @@ -19,7 +23,7 @@ const types = [
];
function select(id) {
emit('update:modelValue', id);
emit('update:selected', id);
emit('close');
}
</script>
Expand All @@ -30,19 +34,46 @@ function select(id) {
<h3>{{ $t('voting.selectVoting') }}</h3>
</template>
<div class="mt-4 mx-0 md:mx-4">
<a v-if="selected" @click="select(undefined)">
<Block>
<a v-if="allowAny" @click="select(undefined)">
<Block
:class="[
'transition-colors relative voting-type',
{ 'voting-type-active': !selected }
]"
>
<i
v-if="!selected"
class="iconfont iconcheck1 absolute top-2 right-2 text-lg"
/>
<h3>
{{ $t('settings.anyType') }}
</h3>
</Block>
</a>
<a v-for="type in types" :key="type" @click="select(type)">
<Block class="button--submit">
<h3 v-text="$t(`voting.${type}`)" />
<a v-for="(type, key) in types" :key="key" @click="select(type)">
<Block
:class="[
'transition-colors relative voting-type',
{ 'voting-type-active': type === selected }
]"
>
<i
v-if="type === selected"
class="iconfont iconcheck1 absolute top-2 right-2 text-lg"
/>
<h3 v-text="$t(`voting.${type}`)" class="mt-0" />
<div v-text="$t(`voting.description.${type}`)" class="text-color" />
</Block>
</a>
</div>
</UiModal>
</template>

<style scoped lang="scss">
.voting-type {
&.voting-type-active,
&:hover {
border-color: var(--link-color);
}
}
</style>
2 changes: 1 addition & 1 deletion src/views/SpaceCreate.vue
Original file line number Diff line number Diff line change
Expand Up @@ -416,7 +416,7 @@ watchEffect(() => {
<ModalVotingType
:open="modalVotingTypeOpen"
@close="modalVotingTypeOpen = false"
v-model="form.type"
v-model:selected="form.type"
/>
</teleport>
</template>
Expand Down
4 changes: 2 additions & 2 deletions src/views/SpaceSettings.vue
Original file line number Diff line number Diff line change
Expand Up @@ -665,8 +665,8 @@ watchEffect(async () => {
<ModalVotingType
:open="modalVotingTypeOpen"
@close="modalVotingTypeOpen = false"
v-model="form.voting.type"
:selected="form.voting?.type"
v-model:selected="form.voting.type"
allowAny
/>
</teleport>
</template>

0 comments on commit d00ee76

Please sign in to comment.