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 19 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
  •  
  •  
  •  
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
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