Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Annotations / Page Notes / Orphans selection tabs with a standard view switcher component #429

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
54 changes: 30 additions & 24 deletions src/sidebar/templates/selection-tabs.html
@@ -1,36 +1,42 @@
<!-- Tabbed display of annotations and notes. -->
<div class="selection-tabs">
<a class="selection-tabs__type"
href="#"
ng-class="{'is-selected': vm.selectedTab === vm.TAB_ANNOTATIONS}"
h-on-touch="vm.selectTab(vm.TAB_ANNOTATIONS)">
Annotations
<button class="selection-tabs__type"
ng-class="{'is-selected': vm.selectedTab === vm.TAB_ANNOTATIONS}"
h-on-touch="vm.selectTab(vm.TAB_ANNOTATIONS)">
<span class="selection-tabs__label">
Annotations
</span>

<span class="selection-tabs__count"
ng-if="vm.totalAnnotations > 0 && !vm.isWaitingToAnchorAnnotations">
ng-if="!vm.isWaitingToAnchorAnnotations">
{{ vm.totalAnnotations }}
</span>
</a>
<a class="selection-tabs__type"
href="#"
ng-class="{'is-selected': vm.selectedTab === vm.TAB_NOTES}"
h-on-touch="vm.selectTab(vm.TAB_NOTES)">
Page Notes
</button>
<button class="selection-tabs__type"
href="#"
ng-class="{'is-selected': vm.selectedTab === vm.TAB_NOTES}"
h-on-touch="vm.selectTab(vm.TAB_NOTES)">
<span class="selection-tabs__label">
Page Notes
</span>

<span class="selection-tabs__count"
ng-if="vm.totalNotes > 0 && !vm.isWaitingToAnchorAnnotations">
ng-if="!vm.isWaitingToAnchorAnnotations">
{{ vm.totalNotes }}
</span>
</a>
<a class="selection-tabs__type selection-tabs__type--orphan"
ng-if="vm.orphansTabFlagEnabled() && vm.totalOrphans > 0"
href="#"
ng-class="{'is-selected': vm.selectedTab === vm.TAB_ORPHANS}"
h-on-touch="vm.selectTab(vm.TAB_ORPHANS)">
Orphans
<span class="selection-tabs__count"
ng-if="vm.totalOrphans > 0 && !vm.isWaitingToAnchorAnnotations">
{{ vm.totalOrphans }}
</button>
<button class="selection-tabs__type selection-tabs__type--orphan"
href="#"
ng-class="{'is-selected': vm.selectedTab === vm.TAB_ORPHANS}"
h-on-touch="vm.selectTab(vm.TAB_ORPHANS)">
<span class="selection-tabs__label">
Orphans
</span>

<span class="selection-tabs__count">
12
</span>
</a>
</button>
</div>
<div ng-if="!vm.isLoading()" class="selection-tabs__empty-message">
<div ng-if="vm.showNotesUnavailableMessage()" class="annotation-unavailable-message">
Expand Down
71 changes: 47 additions & 24 deletions src/styles/selection-tabs.scss
@@ -1,45 +1,68 @@
.selection-tabs {

display: flex;
flex-direction: row;
color: $grey-5;
@include font-normal;

&:hover {
color: $grey-6;
}
justify-content: center;

padding-bottom: 10px;
margin-top: 1px;
margin-bottom: 6px;
}

.selection-tabs__type {
color: $grey-6;
margin-right: 20px;
cursor: pointer;
min-width: 85px;
min-height: 18px;
display: flex;
justify-content: center;
height: 30px;
width: 106px;

font-weight: bold;

// Disable focus ring for selected tab
outline: none;
color: #626262;
background-color: rgb(236, 236, 236);
transition: background-color 100ms linear;

border: 1px solid #626262;
border-right-width: 0;

padding-left: 12px;
padding-right: calc(12px - 7px);

touch-action: manipulation;
cursor: pointer;
user-select: none;

-webkit-appearance: button;
}

.selection-tabs__type:focus {
outline:0 !important;
}

.selection-tabs__type:first-child {
border-top-left-radius: 2px;
border-bottom-left-radius: 2px;
}

.selection-tabs__type:last-child {
border-top-right-radius: 2px;
border-bottom-right-radius: 2px;
border-right-width: 1px;
}

.selection-tabs__type:hover,
.selection-tabs__type.is-selected {
font-weight: bold;
color: #f1f1f1;
background-color: #626262;
}

.selection-tabs__label {
flex-basis: 200px;
}

.selection-tabs__count {
position: relative;
bottom: 3px;
font-size: 10px;
flex-basis: 21px;
padding-left: 7px;
padding-right: 7px;
}

.selection-tabs__empty-message {
position: relative;
top: 10px;
}

.selection-tabs__type--orphan {
margin-left: -5px;
}