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

[3] remove unused webpack deps #3681

Merged
merged 40 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
75d59f8
new looks of tabs
dimaMachina Jul 4, 2024
a7082d6
add graphiql react too
dimaMachina Jul 4, 2024
39724c6
all fixes
dimaMachina Jul 4, 2024
9986069
more polishing
dimaMachina Jul 4, 2024
7cad659
more
dimaMachina Jul 4, 2024
85c1939
more
dimaMachina Jul 4, 2024
271e268
more
dimaMachina Jul 4, 2024
ba3f9c3
more
dimaMachina Jul 4, 2024
721afa2
more
dimaMachina Jul 4, 2024
5dd3707
prettier
dimaMachina Jul 4, 2024
78afcd0
polish changeset
dimaMachina Jul 4, 2024
e5277a2
Merge branch 'main' into new-tabs
dimaMachina Jul 23, 2024
b495ed1
Merge branch 'main' into new-tabs
dimaMachina Jul 24, 2024
5e16d76
disable shrinking while changing the operation name
dimaMachina Jul 24, 2024
956af89
Update packages/graphiql-react/src/ui/tabs.css
dimaMachina Jul 24, 2024
a22d4ab
Merge branch 'main' into new-tabs
dimaMachina Jul 25, 2024
c8112fe
yarn i
dimaMachina Jul 25, 2024
30d6e58
Merge branch 'main' into new-tabs
dimaMachina Jul 25, 2024
34010d5
Merge branch 'main' into new-tabs
dimaMachina Aug 5, 2024
62656d0
apply new design changes
dimaMachina Aug 5, 2024
cdcc678
prettier
dimaMachina Aug 5, 2024
a5d4c70
vite
dimaMachina Aug 6, 2024
9180437
fix demo
dimaMachina Aug 6, 2024
5be31b7
fix cspell
dimaMachina Aug 6, 2024
47e495e
fix dev
dimaMachina Aug 6, 2024
a9304f1
update cypress to v13
dimaMachina Aug 7, 2024
538938c
upd cache key
dimaMachina Aug 7, 2024
80c6811
Merge branch 'upd-cypress' into vite
dimaMachina Aug 7, 2024
b4e83a8
remove webpack deps
dimaMachina Aug 7, 2024
154942d
fix `yarn jest --coverage`
dimaMachina Aug 7, 2024
6d67b9f
Merge branch 'main' into vite
dimaMachina Aug 7, 2024
a803214
Update .changeset/thirty-spoons-call.md
dimaMachina Aug 7, 2024
19ac114
Update packages/graphiql/vite.config.mts
dimaMachina Aug 7, 2024
5c92320
Merge branch 'new-tabs' into vite
dimaMachina Aug 7, 2024
4b5de1a
merge
dimaMachina Aug 7, 2024
0544b30
add changeset
dimaMachina Aug 7, 2024
1c35c74
Merge branch 'vite' into remove-webpack-deps
dimaMachina Aug 7, 2024
8044217
yarn.lock
dimaMachina Aug 7, 2024
0af984b
Merge branch 'graphiql-v4' into remove-webpack-deps
dimaMachina Aug 7, 2024
e15407a
yarn.lock
dimaMachina Aug 7, 2024
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
Prev Previous commit
Next Next commit
apply new design changes
  • Loading branch information
dimaMachina committed Aug 5, 2024
commit 62656d09d3a38fe8dc21a4b7081be4ef0cdb6436
2 changes: 1 addition & 1 deletion packages/graphiql-react/src/style/root.css
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
/* Layout */
--sidebar-width: 60px;
--toolbar-width: 40px;
--session-header-height: 51px;
--session-header-height: 38.5px;
}

@media (prefers-color-scheme: dark) {
Expand Down
50 changes: 30 additions & 20 deletions packages/graphiql-react/src/ui/tabs.css
Original file line number Diff line number Diff line change
@@ -1,40 +1,36 @@
.graphiql-tabs {
--bg: hsl(var(--color-base));

display: flex;
align-items: center;
gap: var(--px-8);
padding: var(--px-8) 0;
margin: 0 var(--px-8)
/* when using padding while scrolling, tab items will overflow to padding area */;
overflow-x: auto;
/* reset browser defaults */
padding:0;
margin: 0;
list-style: none;
}

.graphiql-tab,
.graphiql-tab-wrapper {
border-radius: var(--border-radius-8) var(--border-radius-8) 0 0;
/* trick to shrink multiple tabs, instead of overflow container */
.graphiql-tabs, .graphiql-tab {
min-width: 0;
}

.graphiql-tab {
border-radius: var(--border-radius-8) var(--border-radius-8) 0 0;
background: hsla(var(--color-neutral), var(--alpha-background-light));
position: relative;
display: flex;
max-width: 140px;

/* disable shrinking while changing the operation name */
&:not(:focus-within) {
transform: none !important;
}

.graphiql-tab-wrapper {
position: relative;
display: flex;
align-items: center;
max-width: 140px;
color: hsla(var(--color-neutral), var(--alpha-secondary));
backdrop-filter: blur(9999px);
}

&:hover,
&:focus-within,
&.graphiql-tab-active {
background: hsla(var(--color-neutral), 0.2);
background: var(--bg);
color: hsl(var(--color-neutral));

.graphiql-tab-close {
Expand All @@ -46,7 +42,7 @@
border-radius: var(--border-radius-8) var(--border-radius-8) 0 0;
overflow: hidden;
text-overflow: ellipsis;
padding: var(--px-4) 28px var(--px-4) var(--px-8);
padding: var(--px-4) var(--px-8);

&:hover {
background: none;
Expand All @@ -55,8 +51,12 @@

.graphiql-tab-close {
position: absolute;
right: var(--px-4);
right: min(var(--px-4), 5%);
top: 50%;
transform: translateY(-50%);
display: none;
background: var(--bg);
box-shadow: -10px 0 10px 0 var(--bg);
padding: var(--px-6);
line-height: 0;

Expand All @@ -66,8 +66,18 @@
}

&:hover {
background: hsla(var(--color-neutral), 0.3);
background: var(--bg);
color: hsl(var(--color-neutral));
overflow: hidden; /* bg in `:before` will not overflow from radius area */

/* trick to add 2nd bg with opacity */
&:before {
content: '';
position: absolute;
inset: 0;
z-index: -1;
background: hsla(var(--color-neutral), 0.3);
}
}
}
}
23 changes: 10 additions & 13 deletions packages/graphiql-react/src/ui/tabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { clsx } from 'clsx';
import { Reorder } from 'framer-motion';
import { CloseIcon } from '../icons';
import { UnStyledButton } from './button';
import { Tooltip } from './tooltip';

import './tabs.css';

Expand All @@ -28,7 +27,7 @@ const TabRoot = forwardRef<HTMLLIElement, TabProps>(
className,
)}
>
<div className="graphiql-tab-wrapper">{children}</div>
{children}
</Reorder.Item>
),
);
Expand All @@ -51,17 +50,15 @@ TabButton.displayName = 'Tab.Button';

const TabClose = forwardRef<HTMLButtonElement, JSX.IntrinsicElements['button']>(
(props, ref) => (
<Tooltip label="Close Tab">
<UnStyledButton
aria-label="Close Tab"
{...props}
ref={ref}
type="button"
className={clsx('graphiql-tab-close', props.className)}
>
<CloseIcon />
</UnStyledButton>
</Tooltip>
<UnStyledButton
aria-label="Close Tab"
{...props}
ref={ref}
type="button"
className={clsx('graphiql-tab-close', props.className)}
>
<CloseIcon />
</UnStyledButton>
),
);
TabClose.displayName = 'Tab.Close';
Expand Down
49 changes: 25 additions & 24 deletions packages/graphiql/src/components/GraphiQL.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -553,39 +553,40 @@ export function GraphiQLInterface(props: GraphiQLInterfaceProps) {
aria-label="Select active operation"
>
{editorContext.tabs.map((tab, index) => (
<Tab
key={tab.id}
value={tab}
isActive={index === editorContext.activeTabIndex}
>
<Tab.Button
aria-controls="graphiql-session"
id={`graphiql-session-tab-${index}`}
onClick={() => {
executionContext.stop();
editorContext.changeTab(index);
}}
<Tooltip key={tab.id} label={tab.title}>
<Tab
value={tab}
isActive={index === editorContext.activeTabIndex}
>
{tab.title}
</Tab.Button>
<Tab.Close
onClick={() => {
if (editorContext.activeTabIndex === index) {
<Tab.Button
aria-controls="graphiql-session"
id={`graphiql-session-tab-${index}`}
onClick={() => {
executionContext.stop();
}
editorContext.closeTab(index);
}}
/>
</Tab>
editorContext.changeTab(index);
}}
>
{tab.title}
</Tab.Button>
<Tab.Close
onClick={() => {
if (editorContext.activeTabIndex === index) {
executionContext.stop();
}
editorContext.closeTab(index);
}}
/>
</Tab>
</Tooltip>
))}
</Tabs>
)}
<Tooltip label="Add tab">
<Tooltip label="New tab">
<UnStyledButton
type="button"
className="graphiql-tab-add"
onClick={handleAddTab}
aria-label="Add tab"
aria-label="New tab"
>
<PlusIcon aria-hidden="true" />
</UnStyledButton>
Expand Down
6 changes: 5 additions & 1 deletion packages/graphiql/src/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@
display: flex;
justify-content: flex-end;
height: var(--session-header-height);
padding: var(--px-8) var(--px-8) 0;
gap: var(--px-8);

.graphiql-tabs + .graphiql-tab-add {
margin-right: auto;
Expand All @@ -94,13 +96,15 @@ button.graphiql-tab-add {
color: hsla(var(--color-neutral), var(--alpha-secondary));
font-size: var(--font-size-h4);
font-weight: var(--font-weight-medium);
padding: var(--px-12) var(--px-16);
}

/* Undo default link styling for the default GraphiQL logo link */
.graphiql-container .graphiql-logo .graphiql-logo-link {
color: hsla(var(--color-neutral), var(--alpha-secondary));
text-decoration: none;
&:focus {
outline: hsla(var(--color-neutral), var(--alpha-background-heavy)) auto 1px;
}
}

/* The editor of the session */
Expand Down
Loading