forked from pkp/ui-library
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkp/pkp-lib#3594 Indicate progress in multilingual fields
- Loading branch information
Showing
17 changed files
with
419 additions
and
100 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
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 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 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
95 changes: 95 additions & 0 deletions
95
src/components/MultilingualProgress/MultilingualProgress.vue
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,95 @@ | ||
<template> | ||
<span class="MultilingualProgress" :class="classes"> | ||
<button v-tooltip="tooltip" aria-hidden="true" @click.prevent> | ||
<icon icon="globe" /> | ||
</button> | ||
<span class="-screenReader">{{ tooltip }}</span> | ||
</span> | ||
</template> | ||
|
||
<script> | ||
import Icon from '@/components/Icon/Icon'; | ||
export default { | ||
name: 'MultilingualProgress', | ||
components: { | ||
Icon, | ||
}, | ||
props: { | ||
count: { | ||
type: Number, | ||
required: true, | ||
}, | ||
total: { | ||
type: Number, | ||
required: true, | ||
}, | ||
i18n: { | ||
type: Object, | ||
required: true, | ||
}, | ||
}, | ||
computed: { | ||
/** | ||
* Classes to add to the wrapper element | ||
* | ||
* @return Array | ||
*/ | ||
classes: function () { | ||
let classes = []; | ||
if (this.count === this.total) { | ||
classes.push('MultilingualProgress--isComplete'); | ||
} else if (!this.count) { | ||
classes.push('MultilingualProgress--isEmpty'); | ||
} else { | ||
classes.push('MultilingualProgress--isIncomplete'); | ||
} | ||
return classes; | ||
}, | ||
/** | ||
* Tooltip | ||
* | ||
* @return string | ||
*/ | ||
tooltip: function () { | ||
return this.__('multilingualProgress', { | ||
count: this.count, | ||
total: this.total, | ||
}); | ||
}, | ||
}, | ||
}; | ||
</script> | ||
|
||
<style lang="less"> | ||
@import '../../styles/_import'; | ||
.MultilingualProgress { | ||
display: inline-block; | ||
line-height: @line-sml; | ||
button { | ||
border: none; | ||
background: none; | ||
padding: 0; | ||
cursor: pointer; | ||
} | ||
.fa { | ||
font-size: @line-sml; | ||
} | ||
} | ||
.MultilingualProgress--isEmpty .fa { | ||
color: @text-light; | ||
} | ||
.MultilingualProgress--isIncomplete .fa { | ||
color: @no; | ||
} | ||
.MultilingualProgress--isComplete .fa { | ||
color: @yes; | ||
} | ||
</style> |
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 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
Oops, something went wrong.