aboutsummaryrefslogtreecommitdiff
path: root/src/components/tab_switcher
diff options
context:
space:
mode:
authorShpuld Shpludson <shp@cock.li>2019-01-31 19:21:49 +0000
committerShpuld Shpludson <shp@cock.li>2019-01-31 19:21:49 +0000
commit1a6207be1d81f8270840667babe262c24e53f1d7 (patch)
treef5c6319ad59940b338e41a32ac3614c743709a38 /src/components/tab_switcher
parent3e4c598af471d52664b22ad11435e9df2a8f2677 (diff)
parent476bf0afe1c890b0f08587b3942981c8c591c7be (diff)
Merge branch 'fix/add-option-to-not-render-background-tabs' into 'develop'
Fix #298 Add option to tab switcher to not render background tabs Closes #298 See merge request pleroma/pleroma-fe!504
Diffstat (limited to 'src/components/tab_switcher')
-rw-r--r--src/components/tab_switcher/tab_switcher.js (renamed from src/components/tab_switcher/tab_switcher.jsx)12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/components/tab_switcher/tab_switcher.jsx b/src/components/tab_switcher/tab_switcher.js
index 9038733c..f9c3f927 100644
--- a/src/components/tab_switcher/tab_switcher.jsx
+++ b/src/components/tab_switcher/tab_switcher.js
@@ -4,6 +4,7 @@ import './tab_switcher.scss'
export default Vue.component('tab-switcher', {
name: 'TabSwitcher',
+ props: ['renderOnlyFocused'],
data () {
return {
active: this.$slots.default.findIndex(_ => _.tag)
@@ -44,11 +45,12 @@ export default Vue.component('tab-switcher', {
const contents = this.$slots.default.map((slot, index) => {
if (!slot.tag) return
const active = index === this.active
- return (
- <div class={active ? 'active' : 'hidden'}>
- {slot}
- </div>
- )
+ if (this.renderOnlyFocused) {
+ return active
+ ? <div class="active">{slot}</div>
+ : <div class="hidden"></div>
+ }
+ return <div class={active ? 'active' : 'hidden' }>{slot}</div>
})
return (