feat: use tailwind

This commit is contained in:
swve 2023-05-06 21:18:58 +02:00
parent 32652a1662
commit 7a1d2538e0
7 changed files with 763 additions and 129 deletions

View file

@ -48,8 +48,7 @@ const CoursesIndexPage = (params: any) => {
dialogTitle="Create Course" dialogTitle="Create Course"
dialogDescription="Create a new course" dialogDescription="Create a new course"
dialogTrigger={ dialogTrigger={
<button> Add Course + <button className="rounded-md bg-black antialiased ring-offset-purple-800 p-2 px-5 font text-sm font-bold text-white drop-shadow-lg">Add Course + </button>
</button>
} }
/> />
</Title> </Title>
@ -57,23 +56,25 @@ const CoursesIndexPage = (params: any) => {
{!courses ? ( {!courses ? (
<div>Loading...</div> <div>Loading...</div>
) : ( ) : (
<CourseWrapper> <CourseWrapper className="flex space-x-5">
{courses.map((course: any) => ( {courses.map((course: any) => (
<div key={course.course_id}> <div key={course.course_id}>
<button style={{ backgroundColor: "red", border: "none" }} onClick={() => deleteCourses(course.course_id)}> <div className="flex space-x-2 py-2">
<button className="rounded-md text-sm px-3 font-bold text-red-800 bg-red-200 w-16 flex justify-center items-center" onClick={() => deleteCourses(course.course_id)}>
Delete <Trash size={10}></Trash> Delete <Trash size={10}></Trash>
</button> </button>
<Link href={getUriWithOrg(orgslug, "/course/" + removeCoursePrefix(course.course_id))}>
<Link href={getUriWithOrg(orgslug, "/course/" + removeCoursePrefix(course.course_id) + "/edit")}> <Link href={getUriWithOrg(orgslug, "/course/" + removeCoursePrefix(course.course_id) + "/edit")}>
<button> <button className="rounded-md text-sm px-3 font-bold text-orange-800 bg-orange-200 w-16 flex justify-center items-center">
Edit <Edit2 size={10}></Edit2> Edit <Edit2 size={10}></Edit2>
</button> </button>
</Link> </Link>
<CourseThumbnail> </div>
<img src={`${getBackendUrl()}content/uploads/img/${course.thumbnail}`} alt="" /> <Link href={getUriWithOrg(orgslug, "/course/" + removeCoursePrefix(course.course_id))}>
<CourseThumbnail className="inset-0 ring-1 ring-inset ring-black/10 rounded-lg shadow-xl relative w-[249px] h-[131px] bg-cover" style={{backgroundImage : `url(${getBackendUrl()}content/uploads/img/${course.thumbnail})`}}>
</CourseThumbnail> </CourseThumbnail>
<h2>{course.name}</h2>
</Link> </Link>
<h2>{course.name}</h2>
</div> </div>
))} ))}
</CourseWrapper> </CourseWrapper>
@ -86,21 +87,15 @@ export default CoursesIndexPage;
const CourseThumbnail = styled.div` const CourseThumbnail = styled.div`
display: flex; display: flex;
img { img {
width: 249px; width: 249px;
height: 131px; height: 131px;
background: url(), #d9d9d9;
border: 1px solid rgba(255, 255, 255, 0.19);
box-shadow: 0px 13px 33px -13px rgba(0, 0, 0, 0.42);
border-radius: 7px;
} }
`; `;
const CourseWrapper = styled.div` const CourseWrapper = styled.div`
display: flex;
flex-wrap: wrap;
justify-content: space-between;
margin: 0 auto; margin: 0 auto;
max-width: 1500px; max-width: 1500px;
div { div {
@ -114,18 +109,5 @@ const CourseWrapper = styled.div`
height: 50px; height: 50px;
color: #424242; color: #424242;
} }
button {
margin: 4px 0;
border: none;
border-radius: 7px;
background: #000000;
opacity: 0.4;
font-family: "DM Sans", sans-serif;
color: #ffffff;
font-size: 12px;
font-weight: 600;
cursor: pointer;
}
} }
`; `;

View file

@ -11,8 +11,8 @@ const OrgHomePage = (params: any) => {
return ( return (
<div> <div>
<Title>Welcome {orgslug} 👋🏻</Title> <Title>Welcome {orgslug} 👋🏻</Title>
<Link href={getUriWithOrg(orgslug,"/courses")}> <Link href={getUriWithOrg(orgslug, "/courses")}>
<button>See Courses </button> <button className="rounded-md bg-black antialiased ring-offset-purple-800 p-2 px-5 font text-sm font-bold text-white drop-shadow-lg">See Courses </button>
</Link> </Link>
</div> </div>
); );

815
front/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -50,9 +50,11 @@
"@types/react-katex": "^3.0.0", "@types/react-katex": "^3.0.0",
"@types/styled-components": "^5.1.26", "@types/styled-components": "^5.1.26",
"@types/uuid": "^9.0.0", "@types/uuid": "^9.0.0",
"autoprefixer": "^10.4.12", "autoprefixer": "^10.4.14",
"eslint": "8.23.1", "eslint": "8.23.1",
"eslint-config-next": "^13.0.6", "eslint-config-next": "^13.0.6",
"postcss": "^8.4.23",
"tailwindcss": "^3.3.2",
"typescript": "4.8.3" "typescript": "4.8.3"
} }
} }

6
front/postcss.config.js Normal file
View file

@ -0,0 +1,6 @@
module.exports = {
plugins: {
tailwindcss: {},
autoprefixer: {},
},
}

View file

@ -1,6 +1,10 @@
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500&display=swap'); @import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,wght@0,400;0,500;0,700;1,400;1,500&display=swap');
@tailwind base;
@tailwind components;
@tailwind utilities;
html, html,
body { body {
padding: 0; padding: 0;

13
front/tailwind.config.js Normal file
View file

@ -0,0 +1,13 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [
'./app/**/*.{js,jsx,ts,tsx}',
'./components/**/*.{js,jsx,ts,tsx}',
],
theme: {
extend: {},
},
plugins: [],
}