Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
idatt2106_2024_02_frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
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
IDATT2106 - Gruppe 2
idatt2106_2024_02_frontend
Commits
85222b7d
Commit
85222b7d
authored
11 months ago
by
Valdemar Åstorp Beere
Browse files
Options
Downloads
Patches
Plain Diff
feat(component):
Created DisplayInfoForChallengeOrGoal.vue
parent
5a34c94d
No related branches found
No related tags found
3 merge requests
!66
Final merge
,
!43
chore:
,
!4
Pipeline fix
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/DisplayInfoForChallengeOrGoal.vue
+53
-0
53 additions, 0 deletions
src/components/DisplayInfoForChallengeOrGoal.vue
with
53 additions
and
0 deletions
src/components/DisplayInfoForChallengeOrGoal.vue
0 → 100644
+
53
−
0
View file @
85222b7d
<
template
>
<button
@
click=
"display"
class=
"bg-transparent relative p-0 hover:bg-transparent"
>
<img
src=
"@/assets/infoIcon.png"
alt=
"i"
class=
"max-h-4 max-w-4 ml-1"
/>
</button>
<div
v-if=
"displayInfoCard"
class=
"w-[40vh] h-[20vh]md:w-60 md:h-40 group z-50 bg-opacity-50 overflow-hidden absolute mt-8 md:mt-4 md:mr-0 flex flex-col justify-evenly text-wrap"
>
<div
class=
"flex flex-col justify-around w-3/4 md:w-full h-[80%] py-2 px-4 md:py-0 bg-white rounded-2xl border-4 border-green-300 overflow-auto"
>
<p
class=
"text-base md:text-lg text-wrap text-bold"
>
{{
title
.
toUpperCase
()
}}
</p>
<p
class=
"text-xs md:text-sm text-wrap mb-2"
>
Beskrivelse:
{{
description
}}
</p>
<p
v-if=
"completion!==100"
class=
"text-xs md:text-sm text-nowrap text-green-800"
>
Utløper om:
</p>
<Countdown
v-if=
"completion!==100 && screenSize > 763"
class=
"flex flex-row"
countdownSize=
"1.3rem"
labelSize=
".8rem"
mainColor=
"white"
secondFlipColor=
"white"
mainFlipBackgroundColor=
"#30ab0e"
secondFlipBackgroundColor=
'#9af781'
:labels=
"
{ days: 'dager', hours: 'timer', minutes: 'min', seconds: 'sek', }" :deadlineISO="deadline">
</Countdown>
<Countdown
v-else-if=
"completion!==100 && screenSize
<
=
763"
class=
"flex flex-row"
countdownSize=
"1.0rem"
labelSize=
".6rem"
mainColor=
"white"
secondFlipColor=
"white"
mainFlipBackgroundColor=
"#30ab0e"
secondFlipBackgroundColor=
'#9af781'
:labels=
"
{ days: 'dager', hours: 'timer', minutes: 'min', seconds: 'sek', }" :deadlineISO="deadline">
</Countdown>
<p
class=
"text-nowrap text-xs md:text.sm"
v-else
>
Utfordring fullført.
<br/>
Totalt spart:
{{
amountSaved
}}
kr
</p>
</div>
</div>
</
template
>
<
script
setup
lang=
"ts"
>
import
type
{
Challenge
}
from
"
@/types/challenge
"
;
import
type
{
Goal
}
from
"
@/types/goal
"
;
import
{
onUnmounted
,
ref
}
from
"
vue
"
;
import
{
Countdown
}
from
'
vue3-flip-countdown
'
interface
Props
{
challenge
:
Challenge
|
null
|
undefined
goal
:
Goal
|
null
|
undefined
isChallenge
:
boolean
}
const
props
=
defineProps
<
Props
>
()
const
description
=
ref
<
string
>
(
props
.
isChallenge
?
props
.
challenge
!
.
description
:
props
.
goal
!
.
description
)
const
title
=
ref
<
string
>
(
props
.
isChallenge
?
props
.
challenge
!
.
title
:
props
.
goal
!
.
title
)
const
amountSaved
=
ref
<
number
>
(
props
.
isChallenge
?
props
.
challenge
!
.
saved
:
props
.
goal
!
.
saved
)
const
completion
=
ref
<
number
>
(
props
.
isChallenge
?
(
props
.
challenge
?.
completion
??
0
)
:
(
props
.
goal
?.
completion
??
0
));
const
deadline
=
ref
<
string
>
(
props
.
isChallenge
?
props
.
challenge
!
.
due
:
props
.
goal
!
.
due
)
const
displayInfoCard
=
ref
(
false
)
const
display
=
()
=>
{
displayInfoCard
.
value
=
!
displayInfoCard
.
value
}
const
screenSize
=
ref
<
number
>
(
window
.
innerWidth
)
onUnmounted
(()
=>
{
window
.
removeEventListener
(
"
resize
"
,
handleWindowSizeChange
);
});
const
handleWindowSizeChange
=
()
=>
{
screenSize
.
value
=
window
.
innerWidth
;
};
</
script
>
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