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
e4f6e237
Commit
e4f6e237
authored
11 months ago
by
Valdemar Åstorp Beere
Browse files
Options
Downloads
Patches
Plain Diff
refactor(component):
Made Interactive responsive
parent
5eb69232
No related branches found
No related tags found
3 merge requests
!66
Final merge
,
!12
feat(homepage):
,
!4
Pipeline fix
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/components/InteractiveSpare.vue
+14
-4
14 additions, 4 deletions
src/components/InteractiveSpare.vue
with
14 additions
and
4 deletions
src/components/InteractiveSpare.vue
+
14
−
4
View file @
e4f6e237
...
@@ -3,7 +3,7 @@
...
@@ -3,7 +3,7 @@
<!-- Image -->
<!-- Image -->
<img
:src=
"spareImageSrc"
:class=
"['w-' + pngSize, 'h-' + pngSize, imageClass]"
alt=
"Sparemannen"
@
click=
"nextSpeech"
>
<img
:src=
"spareImageSrc"
:class=
"['w-' + pngSize, 'h-' + pngSize, imageClass]"
alt=
"Sparemannen"
@
click=
"nextSpeech"
>
<!-- Speech Bubble -->
<!-- Speech Bubble -->
<div
class=
"rounded-lg bg-white p-4 text-black border-black border-2
"
:style=
"
{ minHeight: '4rem' }
">
<div
v-if=
"currentSpeech"
class=
"rounded-lg bg-white p-4 text-black border-black border-2
min-h-16 max-w-48
"
>
<span>
{{
currentSpeech
}}
</span>
<span>
{{
currentSpeech
}}
</span>
</div>
</div>
</div>
</div>
...
@@ -36,16 +36,26 @@ const props = defineProps<Props>();
...
@@ -36,16 +36,26 @@ const props = defineProps<Props>();
const
speech
=
ref
<
string
[]
>
(
props
.
speech
||
[]);
const
speech
=
ref
<
string
[]
>
(
props
.
speech
||
[]);
const
currentSpeechIndex
=
ref
(
0
);
const
currentSpeechIndex
=
ref
(
0
);
const
currentSpeech
=
ref
(
props
.
speech
[
0
]
||
'
...
'
);
const
currentSpeech
=
computed
(()
=>
speech
.
value
[
currentSpeechIndex
.
value
]
);
const
nextSpeech
=
()
=>
{
const
nextSpeech
=
()
=>
{
if
(
speech
.
value
.
length
>
0
)
{
if
(
speech
.
value
.
length
>
0
)
{
currentSpeechIndex
.
value
=
(
currentSpeechIndex
.
value
+
1
)
%
speech
.
value
.
length
;
// Remove the currently displayed speech first
currentSpeech
.
value
=
props
.
speech
[
currentSpeechIndex
.
value
];
speech
.
value
.
splice
(
currentSpeechIndex
.
value
,
1
);
// Check if there are any speeches left after removal
if
(
speech
.
value
.
length
>
0
)
{
// Move to the next speech or reset to the beginning if the current index is out of range
currentSpeechIndex
.
value
=
currentSpeechIndex
.
value
%
speech
.
value
.
length
;
}
else
{
// If no speeches left, reset index to indicate no available speech
currentSpeechIndex
.
value
=
-
1
;
}
}
}
};
};
const
imageClass
=
computed
(()
=>
{
const
imageClass
=
computed
(()
=>
{
return
[
return
[
'
transform
'
,
'
transform
'
,
...
...
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