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

show active parent title in footer #7

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
16 changes: 15 additions & 1 deletion src/lib/Panel/Footer/Footer.module.css
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
.footer {
display: flex;
gap: 15px;
justify-content: space-between;
gap: 10px;
color: #64748b;
font-size: 0.85rem;
border-block-start: 0.5px solid #e2e8f0;
padding-block: 10px;
padding-inline: var(--scp-gutter-space-inline);
}

.kbdInfo {
display: flex;
gap: 15px;
}

.group {
display: inline-flex;
align-items: center;
Expand Down Expand Up @@ -40,3 +46,11 @@
.iconReturn {
transform: rotateX(180deg);
}

.parentActionTitle {
display: block;
border: 1px solid #cbd5e1;
border-radius: 5px;
font-size: 0.7rem;
padding: 4px 8px;
}
55 changes: 39 additions & 16 deletions src/lib/Panel/Footer/Footer.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { Component } from 'solid-js';
import { Component, Show } from 'solid-js';
import { getActiveParentAction } from '../../actionUtils/actionUtils';
import { useStore } from '../../StoreContext';
import styles from './Footer.module.css';

export interface IconArrowProps {
Expand Down Expand Up @@ -43,23 +45,44 @@ const IconReturn: Component = () => {
};

export const PanelFooter: Component = () => {
const [state] = useStore();

function getParentActionTitle() {
const { isRoot, activeId } = getActiveParentAction(state.activeParentActionIdList);

if (isRoot) {
return null;
}

const parentAction = state.actions[activeId];

return parentAction.title;
}

return (
<div class={styles.footer}>
<div class={styles.group}>
Navigate with{' '}
<kbd class={styles.shortcut}>
<IconArrow />
</kbd>
<kbd class={styles.shortcut}>
<IconArrow direction="down" />
</kbd>
<footer class={styles.footer}>
<div class={styles.kbdInfo}>
<div class={styles.group}>
Navigate with{' '}
<kbd class={styles.shortcut}>
<IconArrow />
</kbd>
<kbd class={styles.shortcut}>
<IconArrow direction="down" />
</kbd>
</div>
<div class={styles.group}>
Select using{' '}
<kbd class={`${styles.shortcut} ${styles.runShortcut}`}>
<IconReturn />
</kbd>
</div>
</div>
<div class={styles.group}>
Select using{' '}
<kbd class={`${styles.shortcut} ${styles.runShortcut}`}>
<IconReturn />
</kbd>
<div>
<Show when={getParentActionTitle()}>
{(title) => <span class={styles.parentActionTitle}>{title}</span>}
</Show>
</div>
</div>
</footer>
);
};