Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
29 changes: 29 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: PR Checks

on:
pull_request:
branches:
- main

jobs:
lint-and-test:
name: Lint and Test
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: npm

- name: Install dependencies
run: npm ci

- name: Lint
run: npm run lint

- name: Test
run: npm test -- --run
2 changes: 1 addition & 1 deletion lib/catalyst/avatar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export function Avatar({
{/* Add an inset border that sits on top of the image */}
<span
className="gw-ring-1 gw-ring-inset gw-ring-black/5 gw-dark:gw-ring-white/5 gw-forced-colors:gw-outline"
gw-aria-hidden="gw-true"
aria-hidden="true"
/>
</span>
);
Expand Down
4 changes: 2 additions & 2 deletions lib/catalyst/fieldset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ export function Label({ className, ...props }) {
);
}

export function Description({ className, disabled, ...props }) {
export function Description({ className, ...props }) {
return (
<HeadlessDescription
{...props}
Expand All @@ -85,7 +85,7 @@ export function Description({ className, disabled, ...props }) {
);
}

export function ErrorMessage({ className, disabled, ...props }) {
export function ErrorMessage({ className, ...props }) {
return (
<HeadlessDescription
{...props}
Expand Down
16 changes: 8 additions & 8 deletions lib/catalyst/pagination.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ export function PaginationPrevious({ href = null, children = "Previous" }) {
>
<svg
className="gw-stroke-current"
gw-data-slot="gw-icon"
gw-viewBox="gw-0 gw-0 gw-16 gw-16"
gw-fill="gw-none"
gw-aria-hidden="gw-true"
data-slot="icon"
viewBox="0 0 16 16"
fill="none"
aria-hidden="true"
>
<path
d="M2.75 8H13.25M2.75 8L5.25 5.5M2.75 8L5.25 10.5"
Expand All @@ -55,10 +55,10 @@ export function PaginationNext({ href = null, children = "Next" }) {
{children}
<svg
className="gw-stroke-current"
gw-data-slot="gw-icon"
gw-viewBox="gw-0 gw-0 gw-16 gw-16"
gw-fill="gw-none"
gw-aria-hidden="gw-true"
data-slot="icon"
viewBox="0 0 16 16"
fill="none"
aria-hidden="true"
>
<path
d="M13.25 8L2.75 8M13.25 8L10.75 10.5M13.25 8L10.75 5.5"
Expand Down
2 changes: 1 addition & 1 deletion lib/catalyst/switch.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ const colors = {
],
};

export function Switch({ color = "dark/zinc", className, children, ...props }) {
export function Switch({ color = "dark/zinc", className, ...props }) {
return (
<HeadlessSwitch
data-slot="control"
Expand Down
7 changes: 4 additions & 3 deletions lib/components/button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ export const Button = React.forwardRef(function Button(
},
ref,
) {
const buttonStyle = outline ? "outline" : plain ? "plain" : style;
let classes = gwMerge(
base,
// styles.base,
Expand All @@ -211,9 +212,9 @@ export const Button = React.forwardRef(function Button(
// : gwMerge(styles.solid, styles.colors[color ?? "dark/zinc"]),
radii[radius],
sizes[size],
style === "filled" ? colorsFilled[color] : "",
style === "outline" ? colorsOutline[color] : "",
style === "plain" ? colorsPlain[color] : "",
buttonStyle === "filled" ? colorsFilled[color] : "",
buttonStyle === "outline" ? colorsOutline[color] : "",
buttonStyle === "plain" ? colorsPlain[color] : "",
className,
);

Expand Down
2 changes: 1 addition & 1 deletion lib/components/display/badge.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export function Badge({ color = "zinc", className, ...props }) {
colors[color],
className,
);
}, [className]);
}, [className, color]);
return <span {...props} className={badgeClass} />;
}

Expand Down
2 changes: 1 addition & 1 deletion lib/components/display/card.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function Card({ className, children, stretch = false, ...props }) {
stretch ? "gw-self-stretch" : "",
className,
);
}, [className]);
}, [className, stretch]);
return (
<div className={cls} {...props}>
{children}
Expand Down
4 changes: 2 additions & 2 deletions lib/components/form/fieldset.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ export function Label({ className, ...props }) {
return <HeadlessLabel {...props} data-slot="label" className={labelClass} />;
}

export function Description({ className, disabled, ...props }) {
export function Description({ className, ...props }) {
const descriptionClass = useMemo(() => {
return gwMerge(
"gw-text-base/6 gw-text-zinc-500 data-[disabled]:gw-opacity-50 sm:gw-text-sm/6 dark:gw-text-zinc-400",
Expand All @@ -78,7 +78,7 @@ export function Description({ className, disabled, ...props }) {
);
}

export function ErrorMessage({ className, disabled, ...props }) {
export function ErrorMessage({ className, ...props }) {
const errorMessageClass = useMemo(() => {
return gwMerge(
"gw-text-base/6 gw-text-red-600 data-[disabled]:gw-opacity-50 sm:gw-text-sm/6 dark:gw-text-red-500",
Expand Down
2 changes: 1 addition & 1 deletion lib/components/layout/container.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ function Container({ className, children, fluid }) {
fluid ? "gw-max-w-screen" : "gw-max-w-screen-2xl",
className,
);
}, [className]);
}, [className, fluid]);
return <div className={containerClass}>{children}</div>;
}

Expand Down
1 change: 1 addition & 0 deletions lib/components/search.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function SearchDotGov({ accessKey, affiliate, placeholder, ...props }) {
setSearchString(e.target.value);
}}
onKeyUp={handleKeyUp}
placeholder={placeholder}
{...props}
/>
);
Expand Down
4 changes: 2 additions & 2 deletions lib/composite/footer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ function Footer({
flickrUrl,
instagramUrl,
linkedInUrl,
usaceLinks,
externalLinks,
usaceLinks = defaultLinks,
externalLinks = defaultOffsiteLinks,
armyLogo,
army250Logo,
usaceLogo,
Expand Down
2 changes: 1 addition & 1 deletion src/app-pages/documentation/buttons/login-button.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ const componentProps_ProfileDropdown = [
];

function validateEmail(email) {
const re = /^[A-Za-z0-9_!#$%&'*+\/=?`{|}~^.-]+@[A-Za-z0-9.-]+$/gm;
const re = /^[A-Za-z0-9_!#$%&'*+/=?`{|}~^.-]+@[A-Za-z0-9.-]+$/gm;
return re.test(email);
}

Expand Down
12 changes: 8 additions & 4 deletions src/app-pages/documentation/forms/radio-group.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMemo, useState } from "react";
import { useEffect, useState } from "react";
import { UsaceBox, Code, Text, H3, RadioGroup } from "../../../../lib";
import { CodeExample } from "../../../app-components/code-example";
import PropsTable from "../../../app-components/props-table";
Expand Down Expand Up @@ -59,11 +59,15 @@ const FT_TO_METERS_SCALAR = 0.3048;
function RadioGroupDocs() {
const [units, setUnits] = useState(null);
const [value, setValue] = useState(200);
useMemo(() => {
useEffect(() => {
if (units?.toLowerCase() == "en")
setValue((value / FT_TO_METERS_SCALAR).toFixed(2));
setValue((currentValue) =>
(currentValue / FT_TO_METERS_SCALAR).toFixed(2),
);
else if (units?.toLowerCase() == "si")
setValue((value * FT_TO_METERS_SCALAR).toFixed(2));
setValue((currentValue) =>
(currentValue * FT_TO_METERS_SCALAR).toFixed(2),
);
}, [units]);
return (
<DocsPage breadcrumbs={pageBreadcrumbs}>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { UsaceBox, Code, Text, H3, H4, Divider, Badge } from "../../../../lib";
import { CodeBlock } from "../../../app-components/code-block";
import { UsaceBox, Code, Text, H3, Divider, Badge } from "../../../../lib";
import { CodeExample } from "../../../app-components/code-example";
import DocsPage from "../_docs-page";
import { TbPlayerTrackNext } from "react-icons/tb";
Expand Down
4 changes: 3 additions & 1 deletion tailwind.config.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import forms from "@tailwindcss/forms";

/** @type {import('tailwindcss').Config} */
export default {
prefix: "gw-",
Expand Down Expand Up @@ -32,5 +34,5 @@ export default {
},
},
darkMode: "class",
plugins: [require("@tailwindcss/forms")],
plugins: [forms],
};
Loading