Skip to content

Commit

Permalink
Merge pull request #5577 from getkirby/v4/enhancement/language-dropdown
Browse files Browse the repository at this point in the history
Responsive: show only text for language dropdown
  • Loading branch information
bastianallgeier authored Sep 12, 2023
2 parents 8347c08 + bf60ea0 commit 912a0cf
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion panel/src/components/Dropdowns/LanguagesDropdown.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
<k-dropdown v-if="languages.length > 1" class="k-languages-dropdown">
<k-button
:dropdown="true"
:responsive="true"
:text="code"
icon="translate"
responsive="text"
size="sm"
variant="filled"
@click="$refs.languages.toggle()"
Expand Down
12 changes: 9 additions & 3 deletions panel/src/components/Navigation/Button.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ export default {
/**
* A responsive button will hide the button text on smaller screens
* automatically and only keep the icon. An icon must be set in this case.
* If set to `text`, the icon will be hidden instead.
*/
responsive: Boolean,
responsive: [Boolean, String],
/**
* `rel` attribute for when using with `link`
*/
Expand Down Expand Up @@ -222,6 +223,7 @@ export default {
--button-padding: var(--spacing-2);
--button-rounded: var(--spacing-1);
--button-text-display: block;
--button-icon-display: block;
}
.k-button {
Expand All @@ -245,8 +247,9 @@ export default {
}
.k-button-icon {
flex-shrink: 0;
--icon-color: var(--button-color-icon);
flex-shrink: 0;
display: var(--button-icon-display);
}
.k-button-text {
Expand Down Expand Up @@ -304,11 +307,14 @@ export default {
/** Responsive buttons **/
@container (max-width: 30rem) {
/** TODO: .k-button:is([data-responsive]:has(.k-button-icon)) */
.k-button[data-responsive][data-has-icon="true"] {
.k-button[data-responsive="true"][data-has-icon="true"] {
--button-padding: 0;
aspect-ratio: 1/1;
--button-text-display: none;
}
.k-button[data-responsive="text"][data-has-text="true"] {
--button-icon-display: none;
}
/** TODO: .k-button:is([data-responsive]:has(.k-button-icon)) .k-button-arrow */
.k-button[data-responsive][data-has-icon="true"] .k-button-arrow {
display: none;
Expand Down

0 comments on commit 912a0cf

Please sign in to comment.