Skip to content

Commit

Permalink
Fix some bugs in session state handling + update styling of session s…
Browse files Browse the repository at this point in the history
…tate ui (#402)
  • Loading branch information
jaclarke authored Jan 21, 2025
1 parent b3b2a29 commit e748bf4
Show file tree
Hide file tree
Showing 6 changed files with 148 additions and 117 deletions.
3 changes: 2 additions & 1 deletion shared/common/ui/toggleSwitch/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ export function ToggleSwitch({
className={cn(styles.toggleSwitch, className, {
[styles.checked]: checked,
})}
onClick={() => onChange(!checked)}
>
<div className={styles.track} onClick={() => onChange(!checked)}>
<div className={styles.track}>
<div className={styles.switch} />
</div>
</div>
Expand Down
33 changes: 23 additions & 10 deletions shared/common/ui/toggleSwitch/toggleSwitch.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,31 +2,44 @@

.toggleSwitch {
cursor: pointer;
padding: 8px;
}

.track {
display: flex;
width: calc(var(--switchSize, 18px) * 2 - 4px);
width: calc(var(--switchSize, 18px) * 2 - 8px);
height: var(--switchSize, 18px);
border-radius: var(--switchSize, 18px);
background-color: var(--fullscreenOverlayBg);
transition: background-color 0.2s;
background-color: var(--Grey95);
border: 1px solid var(--Grey90);
overflow: hidden;

.checked & {
background-color: var(--Grey97);
}

@include darkTheme {
background-color: var(--Grey12);
border-color: var(--Grey25);
}
}

.switch {
width: calc(var(--switchSize, 18px) - 4px);
height: calc(var(--switchSize, 18px) - 4px);
width: calc(var(--switchSize, 18px) - 2px);
height: calc(var(--switchSize, 18px) - 2px);
border-radius: var(--switchSize, 18px);
margin: 2px;
background: #b3b3b3;
margin: 1px;
background: #fff;
box-shadow: 0 0 4px rgba(0, 0, 0, 0.18);
transition: transform 0.2s, background-color 0.2s;

@include darkTheme {
background: #333;
background: var(--Grey50);
box-shadow: 0 0 4px rgba(0, 0, 0, 0.4);
}

.checked & {
transform: translateX(calc(var(--switchSize, 18px) - 4px));
background: var(--accentGreen);
transform: translateX(calc(var(--switchSize, 18px) - 8px));
background: #a565cd;
}
}
4 changes: 3 additions & 1 deletion shared/studio/components/sessionState/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,9 @@ const SessionBarContent = observer(function SessionBarContent() {
{state.isLoaded ? (
<div className={styles.openPanel} onClick={() => state.openPanel()}>
<div className={styles.panelButton}>
{overflowCount ? <span>+{overflowCount}</span> : null}
{activeState.length && overflowCount ? (
<span>+{overflowCount}</span>
) : null}
<ChevronDownIcon />
</div>
</div>
Expand Down
Loading

0 comments on commit e748bf4

Please sign in to comment.