Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
Sharkey
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
Service Desk
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
Dima Krasner
Sharkey
Commits
1696c50c
Commit
1696c50c
authored
7 years ago
by
rinsuki
Browse files
Options
Downloads
Patches
Plain Diff
media-listのgridの処理をJSからCSSに移行
parent
e2ad98de
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/web/app/common/views/components/media-list.vue
+35
-42
35 additions, 42 deletions
src/web/app/common/views/components/media-list.vue
with
35 additions
and
42 deletions
src/web/app/common/views/components/media-list.vue
+
35
−
42
View file @
1696c50c
<
template
>
<div
class=
"mk-media-list"
>
<mk-media-image
v-for=
"media in mediaList"
ref=
"media"
:image=
"media"
:key=
"media.id"
/>
<div
class=
"mk-media-list"
:data-count=
"mediaList.length"
>
<template
v-for=
"media in mediaList"
>
<mk-media-image
:image=
"media"
:key=
"media.id"
/>
</
template
>
</div>
</template>
...
...
@@ -9,46 +11,6 @@ import Vue from 'vue';
export
default
Vue
.
extend
({
props
:
[
'
mediaList
'
],
mounted
()
{
const
tags
=
this
.
$refs
.
media
as
Vue
[];
if
(
this
.
mediaList
.
length
==
1
)
{
(
this
.
$el
.
style
as
any
).
gridTemplateRows
=
'
1fr
'
;
(
tags
[
0
].
$el
.
style
as
any
).
gridColumn
=
'
1 / 2
'
;
(
tags
[
0
].
$el
.
style
as
any
).
gridRow
=
'
1 / 2
'
;
}
else
if
(
this
.
mediaList
.
length
==
2
)
{
(
this
.
$el
.
style
as
any
).
gridTemplateColumns
=
'
1fr 1fr
'
;
(
this
.
$el
.
style
as
any
).
gridTemplateRows
=
'
1fr
'
;
(
tags
[
0
].
$el
.
style
as
any
).
gridColumn
=
'
1 / 2
'
;
(
tags
[
0
].
$el
.
style
as
any
).
gridRow
=
'
1 / 2
'
;
(
tags
[
1
].
$el
.
style
as
any
).
gridColumn
=
'
2 / 3
'
;
(
tags
[
1
].
$el
.
style
as
any
).
gridRow
=
'
1 / 2
'
;
}
else
if
(
this
.
mediaList
.
length
==
3
)
{
(
this
.
$el
.
style
as
any
).
gridTemplateColumns
=
'
1fr 0.5fr
'
;
(
this
.
$el
.
style
as
any
).
gridTemplateRows
=
'
1fr 1fr
'
;
(
tags
[
0
].
$el
.
style
as
any
).
gridColumn
=
'
1 / 2
'
;
(
tags
[
0
].
$el
.
style
as
any
).
gridRow
=
'
1 / 3
'
;
(
tags
[
1
].
$el
.
style
as
any
).
gridColumn
=
'
2 / 3
'
;
(
tags
[
1
].
$el
.
style
as
any
).
gridRow
=
'
1 / 2
'
;
(
tags
[
2
].
$el
.
style
as
any
).
gridColumn
=
'
2 / 3
'
;
(
tags
[
2
].
$el
.
style
as
any
).
gridRow
=
'
2 / 3
'
;
}
else
if
(
this
.
mediaList
.
length
==
4
)
{
(
this
.
$el
.
style
as
any
).
gridTemplateColumns
=
'
1fr 1fr
'
;
(
this
.
$el
.
style
as
any
).
gridTemplateRows
=
'
1fr 1fr
'
;
(
tags
[
0
].
$el
.
style
as
any
).
gridColumn
=
'
1 / 2
'
;
(
tags
[
0
].
$el
.
style
as
any
).
gridRow
=
'
1 / 2
'
;
(
tags
[
1
].
$el
.
style
as
any
).
gridColumn
=
'
2 / 3
'
;
(
tags
[
1
].
$el
.
style
as
any
).
gridRow
=
'
1 / 2
'
;
(
tags
[
2
].
$el
.
style
as
any
).
gridColumn
=
'
1 / 2
'
;
(
tags
[
2
].
$el
.
style
as
any
).
gridRow
=
'
2 / 3
'
;
(
tags
[
3
].
$el
.
style
as
any
).
gridColumn
=
'
2 / 3
'
;
(
tags
[
3
].
$el
.
style
as
any
).
gridRow
=
'
2 / 3
'
;
}
}
});
</
script
>
...
...
@@ -60,4 +22,35 @@ export default Vue.extend({
@media (max-width 500px)
height 192px
&[data-count="1"]
grid-template-rows 1fr
&[data-count="2"]
grid-template-columns 1fr 1fr
grid-template-rows 1fr
&[data-count="3"]
grid-template-columns 1fr 0.5fr
grid-template-rows 1fr 1fr
:nth-child(1)
grid-row 1 / 3
:nth-child(3)
grid-column 2 / 3
grid-row 2/3
&[data-count="4"]
grid-template-columns 1fr 1fr
grid-template-rows 1fr 1fr
:nth-child(1)
grid-column 1 / 2
grid-row 1 / 2
:nth-child(2)
grid-column 2 / 3
grid-row 1 / 2
:nth-child(3)
grid-column 1 / 2
grid-row 2 / 3
:nth-child(4)
grid-column 2 / 3
grid-row 2 / 3
</
style
>
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