Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
monnaie-libre-fr
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Monitor
Service Desk
Analyze
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
websites
monnaie-libre-fr
Commits
9fb34b91
Commit
9fb34b91
authored
3 years ago
by
Emmanuel Salomon
Browse files
Options
Downloads
Patches
Plain Diff
List and Box global components
parent
0e063e14
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
components/global/Box.vue
+48
-0
48 additions, 0 deletions
components/global/Box.vue
components/global/List.vue
+104
-0
104 additions, 0 deletions
components/global/List.vue
with
152 additions
and
0 deletions
components/global/Box.vue
0 → 100644
+
48
−
0
View file @
9fb34b91
<
template
>
<component
:is=
"to ? 'nuxt-link' : 'div'"
:to=
"to"
class=
"block rounded p-4"
:class=
"computedClass"
>
<slot
/>
</component>
</
template
>
<
script
>
export
default
{
name
:
'
Box
'
,
props
:
{
to
:
{
type
:
[
String
,
Object
],
default
:
null
,
},
color
:
{
type
:
String
,
default
:
null
,
},
},
computed
:
{
computedClass
()
{
let
classes
=
''
if
(
this
.
color
)
{
classes
+=
`bg-
${
this
.
color
}
-100 dark:bg-
${
this
.
color
}
-900`
}
else
{
classes
=
`border dark:border-gray-700`
}
if
(
this
.
to
)
classes
+=
'
transition transform hover:shadow-xl hover:-translate-y-0.5 is-box-with-link
'
return
classes
},
},
}
</
script
>
<
style
lang=
"postcss"
scoped
>
.is-box-with-link {
text-decoration: none !important;
color: currentColor !important;
font-weight: normal !important;
}
</
style
>
This diff is collapsed.
Click to expand it.
components/global/List.vue
0 → 100644
+
104
−
0
View file @
9fb34b91
<
template
>
<div
class=
"prose dark:prose-dark"
>
<slot
/>
<slot
v-if=
"Array.isArray(data)"
name=
"items"
:items=
"data"
>
<ul
class=
"list"
>
<li
v-for=
"(item, i) in data"
:key=
"i"
>
<nuxt-link
:to=
"item.path"
>
<div
v-if=
"title"
>
{{
item
.
title
}}
</div>
</nuxt-link>
<span
v-if=
"description"
>
{{
item
.
description
}}
</span>
</li>
</ul>
</slot>
<slot
v-else-if=
"data"
name=
"item"
>
<h2
v-if=
"title"
>
{{
data
.
title
}}
</h2>
<p
v-if=
"description"
>
{{
data
.
description
}}
</p>
</slot>
</div>
</
template
>
<
script
>
export
default
{
name
:
'
List
'
,
props
:
{
content
:
{
type
:
String
,
default
:
null
,
},
only
:
{
type
:
[
String
,
Array
],
default
:
null
,
},
where
:
{
type
:
Object
,
default
:
null
,
},
sortBy
:
{
type
:
String
,
default
:
null
,
},
direction
:
{
type
:
String
,
default
:
'
asc
'
,
validator
(
value
)
{
return
[
'
asc
'
,
'
desc
'
].
includes
(
value
)
},
},
skip
:
{
type
:
[
Number
,
String
],
default
:
null
,
},
search
:
{
type
:
String
,
default
:
null
,
},
searchField
:
{
type
:
String
,
default
:
null
,
},
limit
:
{
type
:
[
Number
,
String
],
default
:
null
,
},
title
:
{
type
:
Boolean
,
default
:
true
,
},
description
:
{
type
:
Boolean
,
default
:
false
,
},
readingTime
:
{
type
:
Boolean
,
default
:
false
,
},
},
data
()
{
return
{
data
:
null
,
}
},
async
fetch
()
{
if
(
this
.
content
)
{
const
content
=
this
.
$content
(
this
.
content
)
if
(
this
.
only
)
content
.
only
(
this
.
only
)
if
(
this
.
where
)
content
.
where
(
this
.
where
)
if
(
this
.
sortBy
)
content
.
sortBy
(
this
.
sortBy
,
this
.
direction
)
if
(
this
.
skip
)
content
.
skip
(
+
this
.
skip
)
if
(
this
.
search
)
{
this
.
searchField
?
content
.
search
(
this
.
searchField
,
this
.
search
)
:
content
.
search
(
this
.
search
)
}
if
(
this
.
limit
)
content
.
limit
(
+
this
.
limit
)
this
.
data
=
await
content
.
fetch
()
}
},
}
</
script
>
<
style
lang=
"postcss"
scoped
></
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