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

Feature/add new mode for attributions #136

Merged
merged 14 commits into from
Aug 1, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/plugins/Attributions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

## unpublished

- Feature: Add new option `'footer'` to configuration parameter `renderType` that changes the attributions to be displayed as a small version of the information box that is always visible.
- Refactor: Replace redundant props with computed properties.

## 1.2.1
Expand Down
2 changes: 1 addition & 1 deletion packages/plugins/Attributions/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ All parameters are optional. However, setting neither `layerAttributions` nor `s
| initiallyOpen | boolean? | Whether the information box is open by default. Only usable when renderType is set to 'independent', otherwise the IconMenu handles this. |
| layerAttributions | layerAttribution[]? | List of attributions that are shown when the matching layer is visible. |
| listenToChanges | string[]? | Store variable paths to listen to for changes. Will update the currently visible layers depending on the current map state on changes to these values. Please mind that, when referencing another plugin, that plugin must be in `addPlugins` before this one. |
| renderType | 'iconMenu' \| 'independent'? | Whether this plugin ('independent') or the IconMenu should handle opening the information box. Defaults to 'independent'. |
| renderType | 'iconMenu' \| 'independent' \| 'footer'? | Defines whether this plugin ('independent') or the IconMenu ('iconMenu') should handle opening the information box or if a small information box should always be visible ('footer'). Defaults to 'independent'. |
| staticAttributions | string[]? | List of static attributions that are always shown. |
| windowWidth | number? | If `renderType` is set to `independent`, sets the width of the container of the attributions. Defaults to 500. |

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
<template>
<v-scroll-x-reverse-transition>
<v-card dense filled :width="width" :color="color" :max-width="maxWidth">
<v-card-title>
<v-card
:class="renderType === 'footer' ? 'polar-plugin-attributions-footer' : ''"
dense
filled
:width="width"
:color="color"
:max-width="maxWidth"
>
<v-card-title v-if="renderType !== 'footer'">
{{ $t('common:plugins.attributions.title') }}
</v-card-title>
<!-- NOTE: The usage of v-html is considered unsafe as it
Expand Down Expand Up @@ -48,7 +55,9 @@ export default Vue.extend({
return this.renderType === 'independent'
},
color() {
return this.renderIndependently ? '#ffffffdd' : ''
return this.renderType === 'independent' || this.renderType === 'footer'
? '#ffffffdd'
: ''
},
maxWidth() {
return this.renderIndependently
Expand Down Expand Up @@ -76,4 +85,13 @@ export default Vue.extend({
})
</script>

<style scoped lang="scss"></style>
<style scoped lang="scss">
.polar-plugin-attributions-footer {
margin: 4px;
}
.polar-plugin-attributions-footer .v-card__text {
font-size: 10px;
padding: 2px;
line-height: 1.1;
}
</style>
2 changes: 1 addition & 1 deletion packages/plugins/Attributions/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export interface AttributionsGetters extends AttributionsState {
listenToChanges: string[]
mapInfo: string[]
initiallyOpen: boolean
renderType: 'independent' | 'iconMenu'
renderType: 'independent' | 'iconMenu' | 'footer'
staticAttributions: string[]
windowWidth: number
}
2 changes: 1 addition & 1 deletion packages/types/custom/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface PluginOptions {
layoutTag?: string // TODO: Might it be useful to move declaration of NineLayoutTag here?
}

export type RenderType = 'iconMenu' | 'independent'
export type RenderType = 'iconMenu' | 'independent' | 'footer'

/** Possible search methods by type */
export type SearchType = 'bkg' | 'gazetteer' | 'wfs' | 'mpapi' | string
Expand Down
Loading