Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
T
Tickcrypt
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Fin Wallis
Tickcrypt
Commits
6745540b
Commit
6745540b
authored
3 years ago
by
Fin Wallis
Browse files
Options
Downloads
Patches
Plain Diff
Adding type prop to event card to indicate whether small event or large event card should be shown
parent
15340295
No related branches found
Branches containing commit
No related tags found
1 merge request
!14
Buy tickets, view owned tickets and miscellaneous files added
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/Components/EventCard.js
+62
-33
62 additions, 33 deletions
frontend/src/Components/EventCard.js
frontend/src/Pages/Marketplace.js
+37
-37
37 additions, 37 deletions
frontend/src/Pages/Marketplace.js
with
99 additions
and
70 deletions
frontend/src/Components/EventCard.js
+
62
−
33
View file @
6745540b
import
React
from
'
react
'
;
import
React
from
"
react
"
;
import
Card
from
'
@mui/material/Card
'
;
import
CardActions
from
'
@mui/material/CardActions
'
;
import
CardContent
from
'
@mui/material/CardContent
'
;
import
CardMedia
from
'
@mui/material/CardMedia
'
;
import
Button
from
'
@mui/material/Button
'
;
import
Typography
from
'
@mui/material/Typography
'
;
import
Paper
from
"
@mui/material/Paper
"
;
import
Card
from
"
@mui/material/Card
"
;
import
Grid
from
"
@mui/material/Grid
"
;
import
CardActions
from
"
@mui/material/CardActions
"
;
import
CardContent
from
"
@mui/material/CardContent
"
;
import
CardMedia
from
"
@mui/material/CardMedia
"
;
import
Button
from
"
@mui/material/Button
"
;
import
Typography
from
"
@mui/material/Typography
"
;
// Event card - Using material UI framework to bootstrap this process
const
EventCard
=
({
eventData
})
=>
{
console
.
log
(
Object
.
values
(
eventData
))
return
(
const
EventCard
=
({
eventData
,
size
})
=>
{
console
.
log
(
Object
.
values
(
eventData
));
return
(
<>
{
/* Small marketplace card */
}
{
size
===
"
small
"
&&
(
<
Card
>
<
CardMedia
<
CardMedia
component
=
"
img
"
sx
=
{{
maxHeight
:
140
}}
height
=
{
140
}
image
=
{
eventData
.
eventImage
}
alt
=
"
Event Image
"
/>
<
CardContent
>
<
div
style
=
{{
overflow
:
"
hidden
"
,
textOverflow
:
"
ellipsis
"
}}
>
<
Typography
gutterBottom
variant
=
"
h5
"
noWrap
component
=
"
div
"
>
{
eventData
.
eventTitle
}
<
/Typography
>
<
/div
>
{
/* Adding text elipsis to add ... automatically */
}
<
div
style
=
{{
overflow
:
"
hidden
"
,
textOverflow
:
"
ellipsis
"
,
height
:
70
,
}}
>
<
Typography
variant
=
"
body2
"
color
=
"
text.secondary
"
>
{
eventData
.
eventDescription
}
<
/Typography
>
<
/div
>
<
/CardContent
>
<
CardActions
>
<
Button
size
=
"
small
"
>
Learn
More
<
/Button
>
<
/CardActions
>
<
/Card
>
)}
{
/* Large marketplace using paper instead */
}
{
size
===
"
large
"
&&
(
<
Paper
>
<
Grid
container
>
<
Grid
item
xs
=
{
6
}
>
<
CardMedia
component
=
"
img
"
sx
=
{{
maxHeight
:
300
}}
height
=
{
30
0
}
sx
=
{{
maxHeight
:
140
}}
height
=
{
14
0
}
image
=
{
eventData
.
eventImage
}
alt
=
"
Event Image
"
/>
<
CardContent
>
<
div
style
=
{{
overflow
:
"
hidden
"
,
textOverflow
:
"
ellipsis
"
}}
>
<
Typography
gutterBottom
variant
=
"
h5
"
noWrap
component
=
"
div
"
>
{
eventData
.
eventTitle
}
<
/Typography
>
<
/div
>
{
/* Adding text elipsis to add ... automatically */
}
<
div
style
=
{{
overflow
:
"
hidden
"
,
textOverflow
:
"
ellipsis
"
,
height
:
70
}}
>
<
Typography
variant
=
"
body2
"
color
=
"
text.secondary
"
>
{
eventData
.
eventDescription
}
<
/Typography
>
<
/div
>
<
/CardContent
>
<
CardActions
>
<
Button
size
=
"
small
"
>
Learn
More
<
/Button
>
<
/CardActions
>
<
/Card
>
);
/>
<
/Grid
>
<
/Grid
>
<
/Paper
>
)}
<
/
>
);
};
export
default
EventCard
;
\ No newline at end of file
export
default
EventCard
;
This diff is collapsed.
Click to expand it.
frontend/src/Pages/Marketplace.js
+
37
−
37
View file @
6745540b
import
React
,
{
useEffect
,
useState
}
from
'
react
'
;
import
EventCard
from
'
../Components/EventCard
'
;
import
{
getAllEvents
}
from
'
../api/events
'
;
import
Grid
from
'
@mui/material/Grid
'
;
import
Typography
from
'
@mui/material/Typography
'
;
import
React
,
{
useEffect
,
useState
}
from
"
react
"
;
import
EventCard
from
"
../Components/EventCard
"
;
import
{
getAllEvents
}
from
"
../api/events
"
;
import
Grid
from
"
@mui/material/Grid
"
;
import
Typography
from
"
@mui/material/Typography
"
;
const
Marketplace
=
()
=>
{
const
[
all
Ticke
ts
,
setAll
Ticke
ts
]
=
useState
([]);
useEffect
(()
=>
{
async
function
getEvents
(){
let
tickets
=
await
getAllEvents
();
setAllTickets
(
tickets
.
data
)
}
getEvents
();
},[]
);
useEffect
(()
=>
{
console
.
log
(
allTickets
)
},[
allTickets
])
return
(
<
Grid
container
spacing
=
{
2
}
sx
=
{{
padding
:
'
50px 90px
'
}}
>
<
Grid
item
container
xs
=
{
12
}
>
<
Typography
variant
=
{
'
h5
'
}
>
All
Events
<
/Typography
>
<
/Grid
>
{
allTickets
.
map
((
val
)
=>
{
return
(
<
Grid
item
xs
=
{
3
}
>
<
EventCard
eventData
=
{
val
}
/
>
<
/Grid
>
)
})}
<
/Grid
>
);
// List of events taken from DB
const
[
all
Even
ts
,
setAll
Even
ts
]
=
useState
([]);
// Selected event to show modal for - If null show list instead!
const
[
selectedEvent
,
setSelectedEvent
]
=
useState
(
null
);
// Get all events for the list on marketplace
useEffect
(()
=>
{
async
function
getEvents
()
{
let
tickets
=
await
get
All
Events
();
setAllEvents
(
tickets
.
data
);
}
getEvents
();
},
[]);
return
(
<
Grid
container
spacing
=
{
2
}
sx
=
{{
padding
:
"
50px 90px
"
}}
>
<
Grid
item
container
xs
=
{
12
}
>
<
Typography
variant
=
{
"
h5
"
}
>
All
Events
<
/Typography
>
<
/Grid
>
<
Grid
item
container
xs
=
{
12
}
>
{
allEvents
.
map
((
val
)
=>
{
return
(
<
Grid
item
xs
=
{
4
}
>
<
EventCard
eventData
=
{
val
}
type
=
{
"
small
"
}
/
>
<
/Grid
>
);
})}
<
/Grid
>
<
/Grid
>
);
};
export
default
Marketplace
;
\ No newline at end of file
export
default
Marketplace
;
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment