Skip to content

Commit

Permalink
web: consistency pass
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kensternberg-authentik committed Mar 29, 2024
1 parent fc00bde commit 05eab20
Show file tree
Hide file tree
Showing 4 changed files with 52 additions and 49 deletions.
31 changes: 15 additions & 16 deletions web/src/user/LibraryPage/ApplicationEmptyState.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { docLink } from "@goauthentik/common/global";
import { adaptCSS } from "@goauthentik/common/utils";
import { AKElement } from "@goauthentik/elements/Base";
import { paramURL } from "@goauthentik/elements/router/RouterOutlet";

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

const styles = adaptCSS([
PFBase,
PFEmptyState,
PFButton,
PFContent,
PFSpacing,
css`
.cta {
display: inline-block;
font-weight: bold;
}
`,
]);

@customElement("ak-library-application-empty-list")
export class LibraryPageApplicationEmptyList extends AKElement {
static styles = styles;
static get styles() {
return [
PFBase,
PFEmptyState,
PFButton,
PFContent,
PFSpacing,
css`
.cta {
display: inline-block;
font-weight: bold;
}
`,
];
}

@property({ attribute: "isadmin", type: Boolean })
isAdmin = false;
Expand Down
28 changes: 14 additions & 14 deletions web/src/user/LibraryPage/ApplicationList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,22 @@ const LAYOUTS = new Map<string, [string, string]>([
],
]);

const styles = [
PFBase,
PFEmptyState,
PFContent,
PFGrid,
css`
.app-group-header {
margin-bottom: 1em;
margin-top: 1.2em;
}
`,
];

@customElement("ak-library-application-list")
export class LibraryPageApplicationList extends AKElement {
static styles = styles;
static get styles() {
return [
PFBase,
PFEmptyState,
PFContent,
PFGrid,
css`
.app-group-header {
margin-bottom: 1em;
margin-top: 1.2em;
}
`,
];
}

@property({ attribute: true })
layout = "row" as LayoutType;
Expand Down
38 changes: 20 additions & 18 deletions web/src/user/LibraryPage/ApplicationSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,24 +18,26 @@ import { customEvent } from "./helpers";

@customElement("ak-library-list-search")
export class LibraryPageApplicationList extends AKElement {
static styles = [
PFBase,
PFDisplay,
css`
input {
width: 30ch;
box-sizing: border-box;
border: 0;
border-bottom: 1px solid;
border-bottom-color: var(--ak-accent);
background-color: transparent;
font-size: 1.5rem;
}
input:focus {
outline: 0;
}
`,
];
static get styles() {
return [
PFBase,
PFDisplay,
css`
input {
width: 30ch;
box-sizing: border-box;
border: 0;
border-bottom: 1px solid;
border-bottom-color: var(--ak-accent);
background-color: transparent;
font-size: 1.5rem;
}
input:focus {
outline: 0;
}
`,
];
}

@property({ attribute: false })
set apps(value: Application[]) {
Expand Down
4 changes: 3 additions & 1 deletion web/src/user/LibraryPage/LibraryPageImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,9 @@ import type { AppGroupList, PageUIConfig } from "./types";

@customElement("ak-library-impl")
export class LibraryPage extends AKElement {
static styles = styles;
static get styles() {
return styles;
}

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

0 comments on commit 05eab20

Please sign in to comment.