Skip to content

Commit

Permalink
🔧 Continue working on the menu selection buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
Schneegans committed Mar 9, 2024
1 parent 305f333 commit 45b6962
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 22 deletions.
21 changes: 3 additions & 18 deletions src/renderer/editor/theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ $kando-highlight-color: #ffc8c8;
// The secondary button is used most of the time. We want it to be a bit darker than
// the default.
.btn-secondary {
--bs-btn-bg: #{rgba(70, 70, 70, 0.6)};
--bs-btn-hover-bg: #{lighten(rgba(70, 70, 70, 0.6), 5%)};
--bs-btn-active-bg: #{lighten(rgba(70, 70, 70, 0.6), 10%)};
--bs-btn-bg: #{rgba(50, 50, 50, 0.4)};
--bs-btn-hover-bg: #{lighten(rgba(50, 50, 50, 0.4), 5%)};
--bs-btn-active-bg: #{lighten(rgba(50, 50, 50, 0.4), 15%)};
--bs-btn-border-color: transparent;
--bs-btn-hover-border-color: transparent;
--bs-btn-active-border-color: transparent;
Expand Down Expand Up @@ -113,21 +113,6 @@ $kando-highlight-color: #ffc8c8;

// Make buttons respond to clicks by moving down a bit.
.btn {
box-shadow: 0 0 20px rgba(0, 0, 0, 0.6);

transition:
transform 150ms ease,
opacity 150ms ease;

// Center text.
display: flex;
align-items: center;
justify-content: center;

&:active {
box-shadow: 0 0 15px rgba(0, 0, 0, 0.6);
}

&.disabled {
background: repeating-linear-gradient(
-45deg,
Expand Down
8 changes: 5 additions & 3 deletions src/renderer/editor/toolbar/templates/menus-tab.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
-->

<div class='d-flex h-100 kando-font'>
<div class='flex-grow-1 row' id='menu-buttons-list'>
<div class='flex-grow-1' id='menu-buttons-list'>
{{#each menus}}
<label class="col-3 btn btn-secondary menu-selection-button">
<label class="btn btn-secondary menu-selection-button">
<input type="radio"
name="menu-selection-button"
data-index="{{index}}"
{{#if active}} checked {{/if}}/>
{{name}}
{{{icon}}}
<span class="name">{{name}}</span>
<span class="shortcut">{{shortcut}}</span>
</label>
{{/each}}
</div>
Expand Down
8 changes: 7 additions & 1 deletion src/renderer/editor/toolbar/toolbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,14 @@
display: none;
}

display: inline-flex;
margin: 10px;
width: 200px;
height: 60px;

&:has(input:checked) {
border: 2px solid white;
border: 2px dashed rgba(255, 255, 255, 0.5);
background: var(--bs-btn-active-bg);
}
}
}
3 changes: 3 additions & 0 deletions src/renderer/editor/toolbar/toolbar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import Handlebars from 'handlebars';
import { EventEmitter } from 'events';
import { IMenu } from '../../../common';
import * as themedIcon from '../common/themed-icon';

/**
* This class is responsible for the toolbar on the bottom of the editor screen. It is an
Expand Down Expand Up @@ -52,6 +53,8 @@ export class Toolbar extends EventEmitter {
const data = menus.map((menu, index) => ({
name: menu.nodes.name,
active: index === currentMenu,
shortcut: menu.shortcut,
icon: themedIcon.createDiv(menu.nodes.icon, menu.nodes.iconTheme).outerHTML,
index,
}));

Expand Down

0 comments on commit 45b6962

Please sign in to comment.