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

feat: Theming - Spectrum variable mapping and light theme #1680

Merged
merged 30 commits into from
Dec 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
4423545
Fixed color swatch hook
bmingles Dec 12, 2023
7bf0f29
Fixed bootstrap mixin semantic colors
bmingles Dec 12, 2023
30cf1f5
Fixed required prop type warnings
bmingles Dec 12, 2023
09a51c1
Styleguide compare Spectrum with Bootstrap
bmingles Dec 12, 2023
af5e801
Spectrum theme variables
bmingles Dec 12, 2023
7a60686
Compare disabled components
bmingles Dec 13, 2023
d013f27
Disabled comparison
bmingles Dec 13, 2023
160b7d4
Adjusted comparison
bmingles Dec 13, 2023
0c79f53
Bootstrap variables
bmingles Dec 13, 2023
caca15c
Mapped spectrum variables
bmingles Dec 13, 2023
b772a2b
Snapshots
bmingles Dec 13, 2023
46cd4bc
Snapshots
bmingles Dec 13, 2023
fe45ba8
Snapshots
bmingles Dec 13, 2023
43c62d4
Snapshots
bmingles Dec 13, 2023
3aa2f80
Snapshots
bmingles Dec 13, 2023
ce99b28
Merge branch 'main' into 1669-spectrum-theme-variables
bmingles Dec 13, 2023
19b94cb
Merge branch 'main' into 1669-spectrum-theme-variables
bmingles Dec 14, 2023
4604194
Snapshots
bmingles Dec 14, 2023
552bbfe
Snapshots
bmingles Dec 14, 2023
08f3bf8
Popover bg color
bmingles Dec 14, 2023
0a653fd
input disabled
bmingles Dec 14, 2023
8c9797d
Dialog styles
bmingles Dec 14, 2023
525fcdd
Merge remote-tracking branch 'origin/main' into pr/bmingles/1680
dsmmcken Dec 15, 2023
fa4e040
Light theme mega commit
dsmmcken Dec 21, 2023
fd3fe24
fix indeterminate check styling
dsmmcken Dec 21, 2023
c1e4049
Merge remote-tracking branch 'origin/main' into pr/bmingles/1680
dsmmcken Dec 21, 2023
541c549
yolo
dsmmcken Dec 21, 2023
4115983
minor color tweak
dsmmcken Dec 21, 2023
d021d9e
pass units
dsmmcken Dec 21, 2023
4d45c0c
trying stuff
dsmmcken Dec 22, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions packages/code-studio/src/main/AppMainContainer.scss
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,7 @@ $nav-space: 4px; // give a gap around some buttons for focus area that are in na
display: flex;
width: 100%;
justify-content: space-between;
align-items: center;

.btn-link {
font-size: $tab-font-size;
Expand Down
14 changes: 3 additions & 11 deletions packages/code-studio/src/main/AppMainContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import {
Button,
InfoModal,
LoadingSpinner,
Logo,
BasicModal,
DebouncedModal,
} from '@deephaven/components';
Expand Down Expand Up @@ -91,7 +92,6 @@ import JSZip from 'jszip';
import SettingsMenu from '../settings/SettingsMenu';
import AppControlsMenu from './AppControlsMenu';
import { getLayoutStorage, getServerConfigValues } from '../redux';
import Logo from '../settings/community-wordmark-app.svg';
import './AppMainContainer.scss';
import WidgetList, { WindowMouseEvent } from './WidgetList';
import EmptyDashboard from './EmptyDashboard';
Expand Down Expand Up @@ -740,12 +740,7 @@ export class AppMainContainer extends Component<
>
<nav className="nav-container">
<div className="app-main-top-nav-menus">
<img
src={Logo}
alt="Deephaven Data Labs"
width="115px"
className="ml-1"
/>
<Logo className="ml-1" style={{ maxHeight: '20px' }} />
<div>
<Button
kind="ghost"
Expand Down Expand Up @@ -800,10 +795,7 @@ export class AppMainContainer extends Component<
onClick={this.handleSettingsMenuShow}
icon={
<span className="fa-layers">
<FontAwesomeIcon
icon={vsGear}
transform="grow-3 right-1 down-1"
/>
<FontAwesomeIcon icon={vsGear} transform="grow-3" />
{isDisconnected && !isAuthFailed && (
<>
<FontAwesomeIcon
Expand Down
2 changes: 1 addition & 1 deletion packages/code-studio/src/settings/LegalNotice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ function LegalNotice(): ReactElement {
<Button kind="ghost" onClick={toggle} icon={vsLaw}>
Legal Notices
</Button>
<Modal isOpen={modal} toggle={toggle} className="theme-bg-light">
<Modal isOpen={modal} toggle={toggle}>
<ModalHeader toggle={toggle}>Legal Notice</ModalHeader>
<ModalBody>
<p>
Expand Down
10 changes: 6 additions & 4 deletions packages/code-studio/src/settings/SettingsMenu.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
@import '@deephaven/components/scss/custom.scss';

$settings-menu-bg: $gray-700;
$settings-menu-width: 400px;
$settings-menu-header-min-height: 60px;
$settings-menu-padding: $spacer-3;
Expand All @@ -9,7 +8,7 @@ $settings-menu-header-color: var(--dh-color-fg);

$settings-menu-collapse-trigger-color: var(--dh-color-fg);

$settings-menu-rule-bg: $gray-600;
$settings-menu-rule-bg: $gray-800;
$settings-menu-rule-button-color: $gray-300;
$settings-menu-rule-border: $gray-400;
$settings-menu-rule-focused-border: $primary;
Expand All @@ -21,9 +20,12 @@ $input-btn-focus-box-shadow-over-primary: 0 0 0 0.2rem
$settings-menu-z-index: $zindex-modal;

.app-settings-menu {
--settings-menu-bg: var(--dh-color-surface-bg);
--dh-color-hr: var(--dh-color-gray-500);

display: flex;
flex-direction: column;
background: $settings-menu-bg;
background: var(--settings-menu-bg);
box-shadow: $box-shadow;
position: fixed;
top: 0;
Expand Down Expand Up @@ -181,7 +183,7 @@ $settings-menu-z-index: $zindex-modal;
.app-settings-footer {
.app-settings-footer-section {
padding: $settings-menu-padding 0;
border-top: 1px solid $gray-800;
border-top: 1px solid var(--dh-color-hr);
.app-settings-footer-item:not(:last-child) {
padding-bottom: $settings-menu-padding;
}
Expand Down
24 changes: 13 additions & 11 deletions packages/code-studio/src/settings/SettingsMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
import {
Button,
CopyButton,
Logo,
ThemeContext,
ThemePicker,
Tooltip,
Expand All @@ -24,7 +25,6 @@ import {
makeMessage,
} from '@deephaven/jsapi-utils';
import { assertNotNull } from '@deephaven/utils';
import Logo from './community-wordmark-app.svg';
import FormattingSectionContent from './FormattingSectionContent';
import LegalNotice from './LegalNotice';
import SettingsMenuSection from './SettingsMenuSection';
Expand Down Expand Up @@ -147,6 +147,7 @@ export class SettingsMenu extends Component<
const userDisplayName = user.displayName ?? user.name;
const hasUserImage = user.image != null && user.image !== '';
const showUserName = userDisplayName !== '';

return (
<div className="app-settings-menu">
<header className="app-settings-menu-header">
Expand Down Expand Up @@ -345,16 +346,17 @@ export class SettingsMenu extends Component<
</div>
</div>
<div className="app-settings-footer-section">
<div className="logo">
<a
target="_blank"
rel="noreferrer noopener"
href="https://deephaven.io"
className="d-inline-block custom-link p-1"
>
<img src={Logo} alt="Deephaven Data Labs" width="230px" />
</a>
</div>
<a
target="_blank"
rel="noreferrer noopener"
href="https://deephaven.io"
style={{
display: 'block',
width: '61.8%',
}}
>
<Logo />
</a>
</div>
</div>
</div>
Expand Down
33 changes: 26 additions & 7 deletions packages/code-studio/src/styleguide/Buttons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ import { Button, ButtonOld, SocketedButton } from '@deephaven/components';
import { dhTruck } from '@deephaven/icons';
import { sampleSectionIdAndClasses } from './utils';

function noOp(): void {
return undefined;
}

interface ButtonsState {
toggle: boolean;
}
Expand Down Expand Up @@ -80,31 +84,38 @@ class Buttons extends Component<Record<string, never>, ButtonsState> {
return (
<div {...sampleSectionIdAndClasses('buttons-socketed')}>
<h5>Socketed Buttons (for linker)</h5>
<SocketedButton style={{ marginBottom: '1rem', marginRight: '1rem' }}>
<SocketedButton
style={{ marginBottom: '1rem', marginRight: '1rem' }}
onClick={noOp}
>
Unlinked
</SocketedButton>
<SocketedButton
style={{ marginBottom: '1rem', marginRight: '1rem' }}
isLinked
onClick={noOp}
>
Linked
</SocketedButton>
<SocketedButton
style={{ marginBottom: '1rem', marginRight: '1rem' }}
isLinkedSource
onClick={noOp}
>
Linked Source
</SocketedButton>
<SocketedButton
style={{ marginBottom: '1rem', marginRight: '1rem' }}
isLinked
isInvalid
onClick={noOp}
>
Error
</SocketedButton>
<SocketedButton
style={{ marginBottom: '1rem', marginRight: '1rem' }}
disabled
onClick={noOp}
>
Disabled
</SocketedButton>
Expand All @@ -130,7 +141,13 @@ class Buttons extends Component<Record<string, never>, ButtonsState> {
>
<h5>Inline Buttons</h5>
Regular btn-inline:
<Button className="mx-2" kind="inline" icon={dhTruck} tooltip="test" />
<Button
className="mx-2"
kind="inline"
icon={dhTruck}
tooltip="test"
onClick={noOp}
/>
Toggle button (class active):
<Button
className="mx-2"
Expand All @@ -143,21 +160,23 @@ class Buttons extends Component<Record<string, never>, ButtonsState> {
tooltip="test"
/>
Disabled:
<Button className="mx-2" kind="inline" disabled>
<Button className="mx-2" kind="inline" disabled onClick={noOp}>
Disabled
</Button>
With Text:
<Button className="mx-2" kind="inline" icon={dhTruck}>
<Button className="mx-2" kind="inline" icon={dhTruck} onClick={noOp}>
<span>Text Button</span>
</Button>
<br />
<br />
<span>btn-link-icon (no text):</span>
<Button kind="ghost" icon={dhTruck} tooltip="test" />
<Button kind="ghost" icon={dhTruck} tooltip="test" onClick={noOp} />
<span className="mx-2">btn-link:</span>
<Button kind="ghost">Text Button </Button>
<Button kind="ghost" onClick={noOp}>
Text Button
</Button>
<span className="mx-2">btn-link (text w/ optional with icon):</span>
<Button kind="ghost" icon={dhTruck}>
<Button kind="ghost" icon={dhTruck} onClick={noOp}>
Text Button
</Button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion packages/code-studio/src/styleguide/Modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function Modals(): React.ReactElement {
</div>
<h2 className="ui-title">Custom Modal</h2>
<div style={{ padding: '1rem' }}>
<div className="modal-dialog theme-bg-light" role="dialog">
<div className="modal-dialog" role="dialog">
<div className="modal-content">
<div className="modal-header">
<h5 className="modal-title">Modal title</h5>
Expand Down
46 changes: 31 additions & 15 deletions packages/code-studio/src/styleguide/SamplesMenu.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* eslint-disable react/jsx-props-no-spreading */
import React, { Key, useCallback, useEffect, useState } from 'react';
import {
ActionButton,
Expand All @@ -12,6 +13,7 @@ import { vsMenu } from '@deephaven/icons';
import {
MENU_CATEGORY_DATA_ATTRIBUTE,
NO_MENU_DATA_ATTRIBUTE,
SPECTRUM_COMPARISON_SAMPLES_ID,
SPECTRUM_COMPONENT_SAMPLES_ID,
} from './constants';

Expand All @@ -26,18 +28,18 @@ type LinkCategory = { category: string; items: Link[] };
* menu category. These will be queried by the SamplesMenu component to build
* up the menu sections.
*/
export function SampleMenuCategory({
'data-menu-category': dataMenuCategory,
}: Record<typeof MENU_CATEGORY_DATA_ATTRIBUTE, string>): JSX.Element {
return <div data-menu-category={dataMenuCategory} />;
export function SampleMenuCategory(
props: Record<typeof MENU_CATEGORY_DATA_ATTRIBUTE, string>
): JSX.Element {
return <div {...props} />;
}

/**
* Creates a menu from h2, h3 elements on the page and assigns them each an id
* for hash navigation purposes. If the current hash matches one of the ids, it
* will scroll to that element. This handles the initial page load scenario.
* Menu sections are identified by divs with MENU_CATEGORY_DATA_ATTRIBUTE
* attributes.
* Menu categories are identified by divs with MENU_CATEGORY_DATA_ATTRIBUTE
* attributes originating from the <SampleMenuCategory> component.
*/
export function SamplesMenu(): JSX.Element {
const [links, setLinks] = useState<LinkCategory[]>([]);
Expand All @@ -53,34 +55,48 @@ export function SamplesMenu(): JSX.Element {
`#${SPECTRUM_COMPONENT_SAMPLES_ID}`
);

const spectrumComparisonSamples = document.querySelector(
`#${SPECTRUM_COMPARISON_SAMPLES_ID}`
);

document
.querySelectorAll(`h2,h3,[${MENU_CATEGORY_DATA_ATTRIBUTE}]`)
.forEach(el => {
if (el.textContent == null || el.hasAttribute(NO_MENU_DATA_ATTRIBUTE)) {
.forEach(headingEl => {
if (
headingEl.textContent == null ||
headingEl.hasAttribute(NO_MENU_DATA_ATTRIBUTE)
) {
return;
}

// Create a new category section
if (el.hasAttribute(MENU_CATEGORY_DATA_ATTRIBUTE)) {
if (headingEl.hasAttribute(MENU_CATEGORY_DATA_ATTRIBUTE)) {
currentCategory = {
category: el.getAttribute(MENU_CATEGORY_DATA_ATTRIBUTE) ?? '',
category:
headingEl.getAttribute(MENU_CATEGORY_DATA_ATTRIBUTE) ?? '',
items: [],
};
categories.push(currentCategory);

return;
}

const id = `${
spectrumComponentsSamples?.contains(el) === true ? 'spectrum-' : ''
}${el.textContent}`
const idPrefix =
// eslint-disable-next-line no-nested-ternary
spectrumComponentsSamples?.contains(headingEl) === true
? 'spectrum-'
: spectrumComparisonSamples?.contains(headingEl) === true
? 'spectrum-compare-'
: '';

const id = `${idPrefix}${headingEl.textContent}`
.toLowerCase()
.replace(/\s/g, '-');

// eslint-disable-next-line no-param-reassign
el.id = id;
headingEl.id = id;

currentCategory.items.push({ id, label: el.textContent });
currentCategory.items.push({ id, label: headingEl.textContent });
});

setLinks(categories);
Expand Down
Loading
Loading