Skip to content

Commit

Permalink
Merge pull request #3 from west2-online/deploy
Browse files Browse the repository at this point in the history
feat: add ui library and member
  • Loading branch information
1379255913 authored Jun 5, 2024
2 parents 2876848 + 8726a39 commit 1a367cd
Show file tree
Hide file tree
Showing 14 changed files with 940 additions and 47 deletions.
5 changes: 5 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions components.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": false,
"tsx": true,
"tailwind": {
"config": "tailwind.config.js",
"css": "@/css/custom.css",
"baseColor": "slate",
"cssVariables": false,
"prefix": ""
},
"aliases": {
"components": "@/components",
"utils": "@/lib/utils"
}
}
5 changes: 0 additions & 5 deletions docs/member.md

This file was deleted.

8 changes: 8 additions & 0 deletions docs/member.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
sidebar_position: 3
---

# 成员列表
import Member from '@site/src/components/Member';

<Member></Member>
27 changes: 26 additions & 1 deletion docusaurus.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import {themes as prismThemes} from 'prism-react-renderer';
import type {Config} from '@docusaurus/types';
import type * as Preset from '@docusaurus/preset-classic';
import * as path from "node:path";

const config: Config = {
title: 'west2-online',
Expand Down Expand Up @@ -50,7 +51,31 @@ const config: Config = {

// 插件
plugins: [

function aliasPlugin() {
return {
name: "alias-plugin",
configureWebpack(config) {
return {
resolve: {
alias: {
"@": path.resolve(__dirname, 'src/')
},
},
};
},
}
},
async function tailwindPlugin(context, options) {
return {
name: "docusaurus-tailwindcss",
configurePostCss(postcssOptions) {
// Appends TailwindCSS and AutoPrefixer.
postcssOptions.plugins.push(require("tailwindcss"));
postcssOptions.plugins.push(require("autoprefixer"));
return postcssOptions;
},
};
},
],

// 主题配置
Expand Down
13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,19 @@
"@docusaurus/theme-mermaid": "^3.4.0",
"@docusaurus/theme-search-algolia": "^3.4.0",
"@mdx-js/react": "^3.0.0",
"clsx": "^2.0.0",
"@radix-ui/react-avatar": "^1.0.4",
"autoprefixer": "^10.4.19",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"lucide-react": "^0.383.0",
"postcss": "^8.4.38",
"prism-react-renderer": "^2.3.0",
"react": "^18.0.0",
"react-dom": "^18.0.0"
"react-dom": "^18.0.0",
"shadcn-ui": "^0.8.0",
"tailwind-merge": "^2.3.0",
"tailwindcss": "^3.4.3",
"tailwindcss-animate": "^1.0.7"
},
"devDependencies": {
"@docusaurus/module-type-aliases": "3.4.0",
Expand Down
32 changes: 32 additions & 0 deletions src/components/Member/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { Avatar, AvatarImage, AvatarFallback } from "@/components/ui/avatar"
import { memberData } from "@/components/Member/memberData";

export default function Component() {
const data = memberData
return (
<div className="container mx-auto py-12 px-4 md:px-6">
{Object.keys(data).map((year) => (
<div key={year} className="mb-12">
<h2 className="text-2xl font-bold mb-6">{year}</h2>
<div className="grid grid-cols-2 md:grid-cols-4 gap-6">
{data[year].map((member, index) => (
<div
key={index}
className="flex flex-col items-center gap-2 bg-white dark:bg-gray-950 p-4 rounded-lg shadow-md"
>
<Avatar>
<img src="/placeholder.svg" alt={member.name} />
<AvatarFallback>{member.name.split(" ").map((word) => word[0])}</AvatarFallback>
</Avatar>
<div className="text-center">
<h3 className="font-semibold">{member.name}</h3>
<p className="text-gray-500 dark:text-gray-400 text-sm">{member.profession}</p>
</div>
</div>
))}
</div>
</div>
))}
</div>
)
}
26 changes: 26 additions & 0 deletions src/components/Member/memberData.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
type MemberData = Record<string, {
avatar: string;
name: string;
profession: string;
}[]>

export const memberData: MemberData = {
"2023": [
{ avatar: "/placeholder-avatar.jpg", name: "John Doe", profession: "Software Engineer" },
{ avatar: "/placeholder-avatar.jpg", name: "Jane Smith", profession: "Product Manager" },
{ avatar: "/placeholder-avatar.jpg", name: "Michael Johnson", profession: "UI/UX Designer" },
{ avatar: "/placeholder-avatar.jpg", name: "Emily Davis", profession: "Data Analyst" },
],
"2022": [
{ avatar: "/placeholder-avatar.jpg", name: "David Lee", profession: "Backend Developer" },
{ avatar: "/placeholder-avatar.jpg", name: "Sarah Kim", profession: "Frontend Developer" },
{ avatar: "/placeholder-avatar.jpg", name: "Tom Wilson", profession: "Project Manager" },
{ avatar: "/placeholder-avatar.jpg", name: "Olivia Chen", profession: "QA Engineer" },
],
"2021": [
{ avatar: "/placeholder-avatar.jpg", name: "Alex Park", profession: "DevOps Engineer" },
{ avatar: "/placeholder-avatar.jpg", name: "Sophia Nguyen", profession: "Business Analyst" },
{ avatar: "/placeholder-avatar.jpg", name: "Ryan Gonzalez", profession: "Mobile Developer" },
{ avatar: "/placeholder-avatar.jpg", name: "Isabella Ramirez", profession: "Content Writer" },
],
}
48 changes: 48 additions & 0 deletions src/components/ui/avatar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
import * as React from "react"
import * as AvatarPrimitive from "@radix-ui/react-avatar"

import { cn } from "@/lib/utils"

const Avatar = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Root>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Root>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Root
ref={ref}
className={cn(
"relative flex h-10 w-10 shrink-0 overflow-hidden rounded-full",
className
)}
{...props}
/>
))
Avatar.displayName = AvatarPrimitive.Root.displayName

const AvatarImage = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Image>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Image>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Image
ref={ref}
className={cn("aspect-square h-full w-full", className)}
{...props}
/>
))
AvatarImage.displayName = AvatarPrimitive.Image.displayName

const AvatarFallback = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Fallback>,
React.ComponentPropsWithoutRef<typeof AvatarPrimitive.Fallback>
>(({ className, ...props }, ref) => (
<AvatarPrimitive.Fallback
ref={ref}
className={cn(
"flex h-full w-full items-center justify-center rounded-full bg-slate-100 dark:bg-slate-800",
className
)}
{...props}
/>
))
AvatarFallback.displayName = AvatarPrimitive.Fallback.displayName

export { Avatar, AvatarImage, AvatarFallback }
15 changes: 8 additions & 7 deletions src/css/custom.css
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/**
* Any CSS included here will be global. The classic template
* bundles Infima by default. Infima is a CSS framework designed to
* work well for content-centric websites.
*/

/* You can override the default Infima variables here. */
@tailwind base;
@tailwind components;
@tailwind utilities;



:root {
--ifm-color-primary: #0d96ff;
--ifm-color-primary-dark: #47afff;
Expand Down Expand Up @@ -40,4 +40,5 @@
height: 24px;
display: flex;
background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M12 .297c-6.63 0-12 5.373-12 12 0 5.303 3.438 9.8 8.205 11.385.6.113.82-.258.82-.577 0-.285-.01-1.04-.015-2.04-3.338.724-4.042-1.61-4.042-1.61C4.422 18.07 3.633 17.7 3.633 17.7c-1.087-.744.084-.729.084-.729 1.205.084 1.838 1.236 1.838 1.236 1.07 1.835 2.809 1.305 3.495.998.108-.776.417-1.305.76-1.605-2.665-.3-5.466-1.332-5.466-5.93 0-1.31.465-2.38 1.235-3.22-.135-.303-.54-1.523.105-3.176 0 0 1.005-.322 3.3 1.23.96-.267 1.98-.399 3-.405 1.02.006 2.04.138 3 .405 2.28-1.552 3.285-1.23 3.285-1.23.645 1.653.24 2.873.12 3.176.765.84 1.23 1.91 1.23 3.22 0 4.61-2.805 5.625-5.475 5.92.42.36.81 1.096.81 2.22 0 1.606-.015 2.896-.015 3.286 0 .315.21.69.825.57C20.565 22.092 24 17.592 24 12.297c0-6.627-5.373-12-12-12'/%3E%3C/svg%3E") no-repeat;
}
}

6 changes: 6 additions & 0 deletions src/lib/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { type ClassValue, clsx } from "clsx"
import { twMerge } from "tailwind-merge"

export function cn(...inputs: ClassValue[]) {
return twMerge(clsx(inputs))
}
13 changes: 13 additions & 0 deletions tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["./src/**/*.{js,jsx,ts,tsx,md,mdx}", "./docs/**/*.{md,mdx}"],
theme: {
extend: {},
},
plugins: [],
darkMode: '',
corePlugins: {
preflight: false,
},
blocklist: ["container"],
}
5 changes: 4 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
// This file is not used in compilation. It is here just for a nice editor experience.
"extends": "@docusaurus/tsconfig",
"compilerOptions": {
"baseUrl": "."
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
}
}
}
Loading

0 comments on commit 1a367cd

Please sign in to comment.