-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
417 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<script> | ||
export default { | ||
name: 'BackgroundImage', | ||
props: { | ||
image_link: { | ||
type: String, | ||
required: true | ||
}, | ||
alt: { | ||
type: String, | ||
required: true | ||
} | ||
}, | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="absolute inset-0 overflow-hidden transition-all"> | ||
<figure class="h-full w-full overflow-hidden"> | ||
<img class="object-cover w-full h-full" :src="image_link" :alt="alt"> | ||
</figure> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script> | ||
export default { | ||
name: 'VCardsContainer', | ||
components: {}, | ||
data() {}, | ||
computed: {}, | ||
mounted() {}, | ||
methods: {} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class=""> | ||
template | ||
</div> | ||
</template> |
44 changes: 44 additions & 0 deletions
44
books-ui/src/components/3_organisms/BooksViewer/BooksViewer.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<script> | ||
import {mapActions, mapGetters} from "vuex"; | ||
import BooksViewerCard from './BooksViewerCard.vue' | ||
import BooksViewerContainer from './BooksViewerContainer.vue' | ||
export default { | ||
name: 'BooksViewer', | ||
components: {BooksViewerCard, BooksViewerContainer}, | ||
data() {}, | ||
computed: { | ||
...mapGetters('userBooks', ['booksList']) | ||
}, | ||
mounted() { | ||
this.fetchUserBooks() | ||
}, | ||
methods: { | ||
...mapActions('userBooks', ['fetchUserBooks']) | ||
} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class=""> | ||
<BooksViewerContainer> | ||
<BooksViewerCard | ||
v-for="item in booksList" | ||
:id="item.id" | ||
:key="item.id" | ||
:owner="item.owner" | ||
:title="item.title" | ||
:author="item.author" | ||
:description="item.description" | ||
:is_public="item.is_public" | ||
:publication="item.publication" | ||
:image_link="item.image_link" | ||
:map_link="item.map_link" | ||
:map_params_id="item.map_params_id" | ||
:variables="item.variables" | ||
:updated_at="item.updated_at" | ||
/> | ||
</BooksViewerContainer> | ||
</div> | ||
</template> |
96 changes: 96 additions & 0 deletions
96
books-ui/src/components/3_organisms/BooksViewer/BooksViewerCard.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
<script> | ||
import BackgroundImage from '@atoms/BackgroundImage.vue'; | ||
import moment from 'moment'; | ||
export default { | ||
name: 'BooksViewerCard', | ||
components: {BackgroundImage}, | ||
props: { | ||
id: { | ||
type: String, | ||
required: true | ||
}, | ||
owner: { | ||
type: String, | ||
required: true | ||
}, | ||
title: { | ||
type: String, | ||
required: true | ||
}, | ||
author: { | ||
type: String, | ||
required: true | ||
}, | ||
description: { | ||
type: String, | ||
required: true | ||
}, | ||
is_public: { | ||
type: Boolean, | ||
required: true | ||
}, | ||
publication: { | ||
type: String, | ||
required: false | ||
}, | ||
image_link: { | ||
type: String, | ||
required: false | ||
}, | ||
map_link: { | ||
type: String, | ||
required: false | ||
}, | ||
map_params_id: { | ||
type: String, | ||
required: false | ||
}, | ||
variables: { | ||
type: Array, | ||
required: false | ||
}, | ||
updated_at: { | ||
type: String, | ||
required: true | ||
} | ||
}, | ||
data() {}, | ||
computed: { | ||
formattedUpdatedAt() { | ||
return moment(this.updated_at).format('MMMM Do YYYY, h:mm:ss a'); | ||
}, | ||
lastUpdated() { | ||
moment.locale("ru"); | ||
return moment(this.updated_at).fromNow(); | ||
} | ||
}, | ||
mounted() {}, | ||
methods: {} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div | ||
class="relative shadow group border border-slate-300 rounded-md cursor-pointer transition-all | ||
hover:rounded-xl hover:border-slate-500 hover:shadow-md | ||
overflow-hidden | ||
" | ||
> | ||
<div class="card text-slate-500"> | ||
<BackgroundImage | ||
:image_link="'https://cdn.britannica.com/45/5645-050-B9EC0205/head-treasure-flower-disk-flowers-inflorescence-ray.jpg'" | ||
class="opacity-0 group-hover:opacity-5 transition-all" | ||
:alt="title" | ||
v-if="false" | ||
/> | ||
<div class="h-full w-full p-4"> | ||
<div> | ||
<h3 class="text-lg font-bold mb-1">{{title}}</h3> | ||
<p test-id="lastUpdated" class="text-xs">Обновлено {{lastUpdated}}</p> | ||
</div> | ||
</div> | ||
</div> | ||
</div> | ||
</template> |
17 changes: 17 additions & 0 deletions
17
books-ui/src/components/3_organisms/BooksViewer/BooksViewerContainer.vue
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<script> | ||
export default { | ||
name: 'BooksViewerContainer', | ||
components: {}, | ||
data() {}, | ||
computed: {}, | ||
mounted() {}, | ||
methods: {} | ||
} | ||
</script> | ||
|
||
<template> | ||
<div class="grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 2xl:grid-cols-6 3xl:grid-cols-7 gap-3"> | ||
<slot /> | ||
</div> | ||
</template> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
books-ui/src/tests/components/1_atoms/ImageBackground.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import {test, describe, expect} from 'vitest' | ||
import { mount} from '@vue/test-utils' | ||
import BackgroundImage from '@atoms/BackgroundImage.vue'; | ||
|
||
describe("tests of BackgroundImage", () => { | ||
test('mount test of BackgroundImage', async () => { | ||
|
||
const wrapper = mount(BackgroundImage, { | ||
shallow: true, | ||
}) | ||
|
||
expect(wrapper.exists()).toBe(true) | ||
}) | ||
}) | ||
|
||
|
15 changes: 15 additions & 0 deletions
15
books-ui/src/tests/components/2_molecules/VCardsContainer.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
import {test, describe, expect} from 'vitest' | ||
import { mount} from '@vue/test-utils' | ||
import VCardsContainer from '@molecules/VCardsContainer.vue'; | ||
|
||
describe("tests of VCardsContainer", () => { | ||
test('mount test of VCardsContainer', async () => { | ||
|
||
const wrapper = mount(VCardsContainer, { | ||
shallow: true, | ||
}) | ||
|
||
expect(wrapper.exists()).toBe(true) | ||
}) | ||
}) | ||
|
Oops, something went wrong.