Skip to content

Commit

Permalink
Rename AppNavigationCounter to CounterBubble
Browse files Browse the repository at this point in the history
Keep the old file to not break existing imports.

Signed-off-by: Vincent Petry <vincent@nextcloud.com>
  • Loading branch information
PVince81 committed Apr 29, 2021
1 parent 4d22ab3 commit 190545b
Show file tree
Hide file tree
Showing 4 changed files with 113 additions and 53 deletions.
57 changes: 4 additions & 53 deletions src/components/AppNavigationCounter/AppNavigationCounter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -20,63 +20,14 @@
-
-->

<docs>
<docs>

### Normal Counter

```
<AppNavigationCounter>314+</AppNavigationCounter>
```

### Highlighted Counter (i.e. mentions)

```
<AppNavigationCounter :highlighted="true">@admin</AppNavigationCounter>
<AppNavigationCounter :highlighted="true">314+</AppNavigationCounter>
```
Deprecated. See CounterBubble.

</docs>

<template>
<div :class="{ 'app-navigation-entry__counter--highlighted': highlighted }"
class="app-navigation-entry__counter">
<slot />
</div>
</template>

<script>
import CounterBubble from '../CounterBubble/CounterBubble'
export default {
name: 'AppNavigationCounter',
props: {
highlighted: {
type: Boolean,
default: false,
},
},
}
export default CounterBubble
</script>

<style lang="scss" scoped>
.app-navigation-entry__counter {
font-size: calc(var(--default-font-size) * .8);
overflow: hidden;
width: fit-content;
max-width: $clickable-area;
text-align: center;
text-overflow: ellipsis;
line-height: 1em;
padding: 4px 8px;
border-radius: var(--border-radius-pill);
background-color: var(--color-background-darker);
&--highlighted {
padding: 4px 6px;
color: var(--color-primary-text);
background-color: var(--color-primary);
}
}
</style>
82 changes: 82 additions & 0 deletions src/components/CounterBubble/CounterBubble.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
<!--
- @copyright Copyright (c) 2019 Marco Ambrosini <marcoambrosini@pm.me>
-
- @author Marco Ambrosini <marcoambrosini@pm.me>
-
- @license GNU AGPL version 3 or any later version
-
- This program is free software: you can redistribute it and/or modify
- it under the terms of the GNU Affero General Public License as
- published by the Free Software Foundation, either version 3 of the
- License, or (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU Affero General Public License for more details.
-
- You should have received a copy of the GNU Affero General Public License
- along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-->

<docs>

### Normal Counter

```
<CounterBubble>314+</CounterBubble>
```

### Highlighted Counter (i.e. mentions)

```
<CounterBubble :highlighted="true">@admin</CounterBubble>
<CounterBubble :highlighted="true">314+</CounterBubble>
```

</docs>

<template>
<div :class="{ 'counter-bubble__counter--highlighted': highlighted }"
class="counter-bubble__counter">
<slot />
</div>
</template>

<script>
export default {
name: 'CounterBubble',
props: {
highlighted: {
type: Boolean,
default: false,
},
},
}
</script>

<style lang="scss" scoped>
.counter-bubble__counter {
font-size: calc(var(--default-font-size) * .8);
overflow: hidden;
width: fit-content;
max-width: $clickable-area;
text-align: center;
text-overflow: ellipsis;
line-height: 1em;
padding: 4px 8px;
border-radius: var(--border-radius-pill);
background-color: var(--color-background-darker);
&--highlighted {
padding: 4px 6px;
color: var(--color-primary-text);
background-color: var(--color-primary);
}
}
</style>
25 changes: 25 additions & 0 deletions src/components/CounterBubble/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/**
* @copyright Copyright (c) 2021 Vincent Petry <vincent@nextcloud.com>
*
* @author Vincent Petry <vincent@nextcloud.com>
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

import CounterBubble from './CounterBubble'

export default CounterBubble
2 changes: 2 additions & 0 deletions src/components/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ import Breadcrumbs from './Breadcrumbs'
import CheckboxRadio from './CheckboxRadio'
import ColorPicker from './ColorPicker'
import Content from './Content'
import CounterBubble from './CounterBubble'
import DatetimePicker from './DatetimePicker'
import EmptyContent from './EmptyContent'
import ListItem from './ListItem'
Expand Down Expand Up @@ -100,6 +101,7 @@ export {
CheckboxRadio,
ColorPicker,
Content,
CounterBubble,
DatetimePicker,
EmptyContent,
ListItem,
Expand Down

0 comments on commit 190545b

Please sign in to comment.