Skip to content

Commit

Permalink
Merge pull request #7 from NJUPT-SAST/dev-love98
Browse files Browse the repository at this point in the history
feat: CSS improvement on ListHeader
  • Loading branch information
love98ooo authored Nov 20, 2023
2 parents d60c3cd + 640c288 commit 734c28d
Show file tree
Hide file tree
Showing 13 changed files with 33 additions and 55 deletions.
8 changes: 1 addition & 7 deletions src/components/AllEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,7 @@ const AllEvent: React.FC = () => {

return (
<div>
<IonItem lines="full">
<IonLabel className='eventsTitleWarpper'>
<IonIcon icon={archiveOutline}></IonIcon>
所有活动
</IonLabel>
</IonItem>
<EventCardList events={events} lines="none"></EventCardList>
<EventCardList eventsTitle="所有活动" events={events} lines="none"></EventCardList>
{fakeInfiniteScroll()}
</div>
)
Expand Down
8 changes: 1 addition & 7 deletions src/components/ConductingEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,7 @@ const ConductingEvents: React.FC = () => {

return (
<div className="conductingEvents">
<IonItem lines="full">
<IonLabel className='eventsTitleWarpper'>
<IonIcon icon={paperPlaneOutline}></IonIcon>
进行中的活动
</IonLabel>
</IonItem>
<EventCardList events={conductingEvent} lines="none"></EventCardList>
<EventCardList eventsTitle="进行中的活动" events={conductingEvent} lines="none"></EventCardList>
</div>
);
};
Expand Down
11 changes: 9 additions & 2 deletions src/components/DepartmentIcon.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
.departmentIcon {
.departmentIconsWarpper {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;

.departmentIcon {
display: flex;
align-items: center;
justify-content: center;
Expand All @@ -8,4 +14,5 @@
margin: 5px;
font-size: 35px;
font-weight: 700;
}
}
}
2 changes: 1 addition & 1 deletion src/components/DepartmentIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const DepartmentIcon = ({ department }: any) => {
}

return (
<div className='departmentsWarpper' onClick={() => handleDepartmentClick(department.id)}>
<div className='departmentIconsWarpper' onClick={() => handleDepartmentClick(department.id)}>
<div className='departmentIcon' style={{ backgroundColor: getRandomColor(department.departmentName) }}>{department.departmentName[0]}</div>
<IonLabel>{department.departmentName}</IonLabel>
</div>
Expand Down
2 changes: 0 additions & 2 deletions src/components/EventCard.scss
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
.eventCard {
max-width: 500px;
width: 85vw;
height: 148px;
display: flex;
flex-direction: column;
justify-content: flex-end;
margin-top: 5px;
margin-bottom: 5px;
padding-bottom: 3px;

ion-card-header {
Expand Down
2 changes: 0 additions & 2 deletions src/components/EventCardList.scss
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
.eventContainer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 100vw;
}
12 changes: 7 additions & 5 deletions src/components/EventCardList.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { IonCard, IonItem, IonList, IonNote } from "@ionic/react";
import { IonCard, IonItem, IonLabel, IonList, IonListHeader, IonNote } from "@ionic/react";
import { Event } from "../context";
import EventCard from "./EventCard";

interface Props {
events: Event[] | null;
eventsTitle?: string | undefined;
lines?: "full" | "inset" | "none";
isShadow?: true | false | undefined;
}

const EventCardList = ({ events, lines, isShadow }: Props) => {
const EventCardList = ({ events, eventsTitle, lines, isShadow }: Props) => {
if (events == null) {
return (
<IonList class='eventContainer'>
Expand All @@ -32,10 +33,11 @@ const EventCardList = ({ events, lines, isShadow }: Props) => {
return (
<>
<IonList class='eventContainer'>
<IonListHeader>
<IonLabel>{eventsTitle !== undefined ? eventsTitle : ""}</IonLabel>
</IonListHeader>
{events.map((item, index) => (
<IonItem key={item.id} lines={lines}>
<EventCard event={item} isShadow={isShadow}></EventCard>
</IonItem>
<EventCard key={index} event={item} isShadow={isShadow}></EventCard>
))}
</IonList>
</>
Expand Down
5 changes: 1 addition & 4 deletions src/components/Subcribe.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,13 @@
flex-direction: column;
width: 100vw;
max-width: 500px;
ion-card {
margin-bottom: 0;
}
.mySubscribeDepartmentsTitleWarpper {
margin: 0;
}

.mySubscribeDepartmentsContentWarpper {
overflow-x: auto;
margin: 15px 0 15px 0;
margin: 15px 0;
}
}
.mySubscribeEventsWarpper {
Expand Down
32 changes: 11 additions & 21 deletions src/components/Subscribe.tsx
Original file line number Diff line number Diff line change
@@ -1,35 +1,25 @@
import { IonCard, IonItem, IonLabel } from "@ionic/react";
import { IonCard, IonItem, IonLabel, IonList, IonListHeader } from "@ionic/react";
import SubscribeDepartments from "./SubscribeDepartments"
import "./Subcribe.scss"
import SubscribedEvents from "./SubscribedEvents";
const subcribePage = () => {
return (
<div className="subscribePageWarpper">
<div style={{ height: "5px" }}></div>
<div className="mySubscribeDepartmentsWarpper">
<IonCard>
<IonItem lines="full">
<div className="mySubscribeDepartmentsTitleWarpper">
我订阅的部门
</div>
</IonItem>
<IonItem>
<IonList>
<IonListHeader>
我订阅的部门
</IonListHeader>
<IonCard>
<div id="mySubscribeDepartmentsContentWarpper" className="mySubscribeDepartmentsContentWarpper">
<SubscribeDepartments></SubscribeDepartments>
</div>
</IonItem>
</IonCard>
</IonCard>
</IonList>
</div>
<div className="mySubscribeEventsWarpper">
<IonCard>
<IonItem lines="full">
<div className="mySubscribeEventsTitleWarpper">
我订阅的活动
</div>
</IonItem>
<div className="mySubscribeEventsContentWarpper">
<SubscribedEvents></SubscribedEvents>
</div>
</IonCard>
<div className="mySubscribeEventsContentWarpper">
<SubscribedEvents></SubscribedEvents>
</div>
</div>
)
Expand Down
2 changes: 1 addition & 1 deletion src/components/SubscribedEvents.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const SubscribedEvents = () => {
}, [])
return (
<div className="subscribedEventsWarpper">
<EventCardList events={subcribeEvents} lines="full" isShadow={true}></EventCardList>
<EventCardList eventsTitle="我订阅的活动" events={subcribeEvents} lines="none" isShadow={false}></EventCardList>
</div>
)
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/SubsrcibedEvents.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
.subscribedEventsWarpper {
box-shadow: none;
// box-shadow: none;
}
1 change: 0 additions & 1 deletion src/pages/Department.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
.eventContainer {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
Expand Down
1 change: 0 additions & 1 deletion src/pages/Event.scss
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
.departments {
display: flex;
flex-direction: row;
font-weight: 700;
}
ion-icon {
color: #99a2aa;
Expand Down

0 comments on commit 734c28d

Please sign in to comment.