Skip to content

Commit 51b3cc1

Browse files
committed
Removes unused CSS from the graph
1 parent 893cdbc commit 51b3cc1

File tree

6 files changed

+428
-309
lines changed

6 files changed

+428
-309
lines changed

src/webviews/apps/plus/graph-next/actions/gitActionsButtons.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { html, LitElement, nothing } from 'lit';
1+
import { css, html, LitElement, nothing } from 'lit';
22
import { customElement, property, state } from 'lit/decorators.js';
33
import { fromNow } from '../../../../../system/date';
44
import { pluralize } from '../../../../../system/string';
@@ -23,7 +23,6 @@ export class GitActionsButtons extends LitElement {
2323
@property({ type: Object })
2424
state!: State;
2525

26-
@state()
2726
private get fetchedText() {
2827
if (!this.lastFetched) return undefined;
2928

@@ -105,7 +104,29 @@ export class GlFetchButton extends LitElement {
105104

106105
@customElement('gl-push-pull-button')
107106
export class PushPullButton extends LitElement {
108-
static override styles = [linkBase, inlineCode, actionButton, ruleBase];
107+
static override styles = [
108+
linkBase,
109+
inlineCode,
110+
actionButton,
111+
ruleBase,
112+
css`
113+
.pill {
114+
display: inline-block;
115+
padding: 0.2rem 0.5rem;
116+
border-radius: 0.5rem;
117+
font-size: 1rem;
118+
font-weight: 500;
119+
line-height: 1.2;
120+
text-transform: uppercase;
121+
color: var(--vscode-foreground);
122+
background-color: var(--vscode-editorWidget-background);
123+
}
124+
.pill code-icon {
125+
font-size: inherit !important;
126+
line-height: inherit !important;
127+
}
128+
`,
129+
];
109130

110131
@property({ type: Object })
111132
branchState?: BranchState;

src/webviews/apps/plus/graph-next/gate.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { consume } from '@lit/context';
2-
import { html } from 'lit';
2+
import { css, html } from 'lit';
33
import { customElement, state } from 'lit/decorators.js';
44
import { ifDefined } from 'lit/directives/if-defined.js';
55
import { createWebviewCommandLink } from '../../../../system/webview';
@@ -11,7 +11,13 @@ import '../../shared/components/feature-gate';
1111

1212
@customElement('gl-graph-gate')
1313
export class GlGraphGate extends GlElement {
14-
static override styles = [];
14+
static override styles = css`
15+
gl-feature-gate gl-feature-badge {
16+
vertical-align: super;
17+
margin-left: 0.4rem;
18+
margin-right: 0.4rem;
19+
}
20+
`;
1521

1622
@consume({ context: stateContext, subscribe: true })
1723
@state()

src/webviews/apps/plus/graph-next/graph-header.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ import type { TelemetryContext } from '../../shared/contexts/telemetry';
4747
import { telemetryContext } from '../../shared/contexts/telemetry';
4848
import { emitTelemetrySentEvent } from '../../shared/telemetry';
4949
import { stateContext } from './context';
50+
import { actionButton, linkBase, titlebarStyles } from './graph.css';
5051
import { graphStateContext } from './stateProvider';
5152
import '@shoelace-style/shoelace/dist/components/option/option.js';
5253
import '@shoelace-style/shoelace/dist/components/select/select.js';
@@ -100,10 +101,12 @@ function getSearchResultIdByIndex(results: GraphSearchResults, index: number): s
100101

101102
@customElement('gl-graph-header')
102103
export class GlGraphHeader extends SignalWatcher(LitElement) {
104+
static override styles = [linkBase, actionButton, titlebarStyles];
105+
103106
// FIXME: remove light DOM
104-
protected override createRenderRoot(): HTMLElement | DocumentFragment {
105-
return this;
106-
}
107+
// protected override createRenderRoot(): HTMLElement | DocumentFragment {
108+
// return this;
109+
// }
107110

108111
@consume({ context: ipcContext })
109112
_ipc!: typeof ipcContext.__context__;

src/webviews/apps/plus/graph-next/graph-next.html

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,11 @@
2020
</head>
2121

2222
<body
23-
class="graph-app scrollable"
23+
class="scrollable"
2424
data-placement="#{placement}"
2525
data-vscode-context='{ "preventDefaultContextMenuItems": true, "webview": "#{webviewId}", "webviewInstance": "#{webviewInstanceId}" }'
2626
>
27-
<gl-graph-app
28-
class="graph-app__container"
29-
name="GraphView"
30-
placement="#{placement}"
31-
bootstrap="#{state}"
32-
></gl-graph-app>
27+
<gl-graph-app name="GraphView" placement="#{placement}" bootstrap="#{state}"></gl-graph-app>
3328
#{endOfBody}
3429
</body>
3530
</html>

src/webviews/apps/plus/graph-next/graph.css.ts

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,3 +136,66 @@ export const actionButton = css`
136136
background-color: var(--branch-status-both-hover-background);
137137
}
138138
`;
139+
140+
export const titlebarStyles = css`
141+
.titlebar {
142+
background: var(--titlebar-bg);
143+
color: var(--titlebar-fg);
144+
padding: {
145+
left: 0.8rem;
146+
right: 0.8rem;
147+
top: 0.6rem;
148+
bottom: 0.6rem;
149+
}
150+
font-size: 1.3rem;
151+
flex-wrap: wrap;
152+
}
153+
.titlebar,
154+
.titlebar__row,
155+
.titlebar__group {
156+
display: flex;
157+
flex-direction: row;
158+
align-items: center;
159+
gap: 0.5rem;
160+
}
161+
162+
.titlebar > *,
163+
.titlebar__row > *,
164+
.titlebar__group > * {
165+
margin: 0;
166+
}
167+
168+
.titlebar,
169+
.titlebar__row {
170+
justify-content: space-between;
171+
}
172+
173+
.titlebar__row {
174+
flex: 0 0 100%;
175+
}
176+
.titlebar__row--wrap {
177+
display: grid;
178+
grid-auto-flow: column;
179+
justify-content: start;
180+
grid-template-columns: 1fr min-content;
181+
}
182+
183+
.titlebar__group {
184+
flex: auto 1 1;
185+
}
186+
187+
.titlebar__row--wrap .titlebar__group {
188+
white-space: nowrap;
189+
}
190+
.titlebar__row--wrap .titlebar__group:nth-child(odd) {
191+
min-width: 0;
192+
}
193+
194+
.titlebar__debugging > * {
195+
display: inline-block;
196+
}
197+
198+
.titlebar gl-feature-badge {
199+
color: var(--color-foreground);
200+
}
201+
`;

0 commit comments

Comments
 (0)