Skip to content

Commit 05eab20

Browse files
web: consistency pass
While investigating the viability of applying purgeCSS to Patternfly4, in order to reduce the weight of our CSS, I found these four locations in our code (all of them *my changes*, darnit), in which our usual `styles` declaration pattern was inconsistent with our own standards. The LibraryPageImpl change would have been too intrusive to make fully compliant. The objective here is to ensure that our objects have *predictable* internal layouts for ease of future maintenance.
1 parent fc00bde commit 05eab20

4 files changed

Lines changed: 52 additions & 49 deletions

File tree

web/src/user/LibraryPage/ApplicationEmptyState.ts

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import { docLink } from "@goauthentik/common/global";
2-
import { adaptCSS } from "@goauthentik/common/utils";
32
import { AKElement } from "@goauthentik/elements/Base";
43
import { paramURL } from "@goauthentik/elements/router/RouterOutlet";
54

@@ -20,23 +19,23 @@ import PFSpacing from "@patternfly/patternfly/utilities/Spacing/spacing.css";
2019
* administrator, provide a link to the "Create a new application" page.
2120
*/
2221

23-
const styles = adaptCSS([
24-
PFBase,
25-
PFEmptyState,
26-
PFButton,
27-
PFContent,
28-
PFSpacing,
29-
css`
30-
.cta {
31-
display: inline-block;
32-
font-weight: bold;
33-
}
34-
`,
35-
]);
36-
3722
@customElement("ak-library-application-empty-list")
3823
export class LibraryPageApplicationEmptyList extends AKElement {
39-
static styles = styles;
24+
static get styles() {
25+
return [
26+
PFBase,
27+
PFEmptyState,
28+
PFButton,
29+
PFContent,
30+
PFSpacing,
31+
css`
32+
.cta {
33+
display: inline-block;
34+
font-weight: bold;
35+
}
36+
`,
37+
];
38+
}
4039

4140
@property({ attribute: "isadmin", type: Boolean })
4241
isAdmin = false;

web/src/user/LibraryPage/ApplicationList.ts

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -31,22 +31,22 @@ const LAYOUTS = new Map<string, [string, string]>([
3131
],
3232
]);
3333

34-
const styles = [
35-
PFBase,
36-
PFEmptyState,
37-
PFContent,
38-
PFGrid,
39-
css`
40-
.app-group-header {
41-
margin-bottom: 1em;
42-
margin-top: 1.2em;
43-
}
44-
`,
45-
];
46-
4734
@customElement("ak-library-application-list")
4835
export class LibraryPageApplicationList extends AKElement {
49-
static styles = styles;
36+
static get styles() {
37+
return [
38+
PFBase,
39+
PFEmptyState,
40+
PFContent,
41+
PFGrid,
42+
css`
43+
.app-group-header {
44+
margin-bottom: 1em;
45+
margin-top: 1.2em;
46+
}
47+
`,
48+
];
49+
}
5050

5151
@property({ attribute: true })
5252
layout = "row" as LayoutType;

web/src/user/LibraryPage/ApplicationSearch.ts

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,24 +18,26 @@ import { customEvent } from "./helpers";
1818

1919
@customElement("ak-library-list-search")
2020
export class LibraryPageApplicationList extends AKElement {
21-
static styles = [
22-
PFBase,
23-
PFDisplay,
24-
css`
25-
input {
26-
width: 30ch;
27-
box-sizing: border-box;
28-
border: 0;
29-
border-bottom: 1px solid;
30-
border-bottom-color: var(--ak-accent);
31-
background-color: transparent;
32-
font-size: 1.5rem;
33-
}
34-
input:focus {
35-
outline: 0;
36-
}
37-
`,
38-
];
21+
static get styles() {
22+
return [
23+
PFBase,
24+
PFDisplay,
25+
css`
26+
input {
27+
width: 30ch;
28+
box-sizing: border-box;
29+
border: 0;
30+
border-bottom: 1px solid;
31+
border-bottom-color: var(--ak-accent);
32+
background-color: transparent;
33+
font-size: 1.5rem;
34+
}
35+
input:focus {
36+
outline: 0;
37+
}
38+
`,
39+
];
40+
}
3941

4042
@property({ attribute: false })
4143
set apps(value: Application[]) {

web/src/user/LibraryPage/LibraryPageImpl.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ import type { AppGroupList, PageUIConfig } from "./types";
3535

3636
@customElement("ak-library-impl")
3737
export class LibraryPage extends AKElement {
38-
static styles = styles;
38+
static get styles() {
39+
return styles;
40+
}
3941

4042
@property({ attribute: "isadmin", type: Boolean })
4143
isAdmin = false;

0 commit comments

Comments
 (0)