Skip to content

Commit

Permalink
Merge branch 'main' of https://github.com/AElfProject/docs-cms into f…
Browse files Browse the repository at this point in the history
…eature/css
  • Loading branch information
AbigailDeng authored and AbigailDeng committed Aug 2, 2024
2 parents b553dde + 6e5b0a3 commit 923af60
Show file tree
Hide file tree
Showing 9 changed files with 2,799 additions and 432 deletions.
1 change: 1 addition & 0 deletions .github/workflows/kubernetes.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
- aelf-docs-dev
- aefinder-docs-dev
- tomorrowdao-docs-dev
- tomorrowdao-docs-prod

jobs:
build:
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow uses actions that are not certified by GitHub.
# They are provided by a third-party and are governed by
# separate terms of service, privacy policy, and support
# documentation.

# GitHub recommends pinning actions to a commit SHA.
# To get a newer version, you will need to update the SHA.
# You can also reference a tag or branch, but the action may change without warning.

name: Pull Request

on:
pull_request:
branches: [main]

jobs:
test:
name: Unit tests
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: Check out the repo
uses: actions/checkout@v4

- uses: actions/setup-node@v4
with:
node-version: 18
cache: 'npm'

- run: npm install
- run: npm test
2 changes: 2 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,6 @@ FROM cgr.dev/chainguard/nginx:latest
WORKDIR /usr/share/nginx/html
COPY out .

COPY nginx.conf /etc/nginx/conf.d/default.conf

EXPOSE 8080
7 changes: 5 additions & 2 deletions components/ui/card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ const Card = React.forwardRef<
>(({ className, ...props }, ref) => (
<div
ref={ref}
className={cn("bg-card text-card-foreground shadow-sm", className)}
className={cn(
"bg-card text-card-foreground shadow-sm rounded-lg",
className
)}
{...props}
/>
));
Expand All @@ -21,7 +24,7 @@ const CardHeader = React.forwardRef<
<div
ref={ref}
className={cn(
"flex flex-col space-y-1.5 p-6 bg-card-background-color rounded-lg border border-card-border-color hover:border-card-hover-border-color ",
"flex flex-col space-y-1.5 p-6 bg-card-background-color rounded-lg border border-card-border-color hover:border-card-hover-border-color h-full",
className
)}
{...props}
Expand Down
42 changes: 42 additions & 0 deletions lib/url.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { describe, it, expect } from "vitest";
import { convertArrToUrl } from "./url"; // Adjust the import path as necessary

describe("convertArrToUrl", () => {
it("should return an empty string if the input is not an array", () => {
expect(convertArrToUrl("not an array" as any)).toBe("");
});

it("should return a slugified string", () => {
const input = ["Hello", "World"];
const expected = "hello-world";
expect(convertArrToUrl(input)).toBe(expected);
});

it("should handle special characters correctly", () => {
const input = ["Hello!", "World?"];
const expected = "hello-world";
expect(convertArrToUrl(input)).toBe(expected);
});

it("should replace 'c#' with 'csharp'", () => {
const input = ["c#", "programming"];
const expected = "csharp-programming";
expect(convertArrToUrl(input)).toBe(expected);
});

it("should handle an empty array", () => {
expect(convertArrToUrl([])).toBe("");
});

it("should convert the array to a lowercase slug", () => {
const input = ["Hello", "World"];
const expected = "hello-world";
expect(convertArrToUrl(input)).toBe(expected);
});

it("should trim the result", () => {
const input = [" Hello ", " World "];
const expected = "hello-world";
expect(convertArrToUrl(input)).toBe(expected);
});
});
2 changes: 1 addition & 1 deletion lib/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import slugify from "slugify";
export const convertArrToUrl = (strArr: string[]) => {
if (!Array.isArray(strArr)) return "";
const result = slugify(strArr.join(" ").replace("c#", "csharp"), {
remove: /[*+~()'"!:@]/g,
remove: /[*+~()'"?!:@]/g,
lower: true,
trim: true,
});
Expand Down
9 changes: 9 additions & 0 deletions nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
server {
listen 8080;
root /usr/share/nginx/html;
port_in_redirect off;

location / {
try_files $uri $uri/ /index.html;
}
}
Loading

0 comments on commit 923af60

Please sign in to comment.