diff --git a/package.json b/package.json index b8898b3..630a6a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@lucaswerey/dslib-pfe", - "version": "0.0.67", + "version": "0.0.68", "private": false, "main": "./lib/index.umd.js", "module": "./lib/index.mjs", diff --git a/src/App.vue b/src/App.vue index 69006cb..1489502 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,46 +1,20 @@ - - + diff --git a/src/assets/icons/desktop.vue b/src/assets/icons/desktop.vue new file mode 100644 index 0000000..a6b0741 --- /dev/null +++ b/src/assets/icons/desktop.vue @@ -0,0 +1,21 @@ + + + + + + + + diff --git a/src/components.d.ts b/src/components.d.ts index ecfe331..74901fb 100644 --- a/src/components.d.ts +++ b/src/components.d.ts @@ -28,6 +28,8 @@ declare module 'vue' { 'InputField.story': typeof import('./components/CTA/InputField/InputField.story.vue')['default'] Loader: typeof import('./components/Indicators/Loader/Loader.vue')['default'] 'Loader.story': typeof import('./components/Indicators/Loader/Loader.story.vue')['default'] + OfferCard: typeof import('./components/Containment/OfferCard/OfferCard.vue')['default'] + 'OfferCard.story': typeof import('./components/Containment/OfferCard/OfferCard.story.vue')['default'] RankingContainer: typeof import('./components/Containment/RankingContainer/RankingContainer.vue')['default'] 'RankingContainer.story': typeof import('./components/Containment/RankingContainer/RankingContainer.story.vue')['default'] SelectField: typeof import('./components/CTA/SelectField/SelectField.vue')['default'] diff --git a/src/components/Containment/OfferCard/OfferCard.model.ts b/src/components/Containment/OfferCard/OfferCard.model.ts new file mode 100644 index 0000000..36fe20d --- /dev/null +++ b/src/components/Containment/OfferCard/OfferCard.model.ts @@ -0,0 +1,34 @@ +/* + Avaible colors: + + basic: + black: '#1B1B1E', + darkgrey: '#787878', + grey: '#CDCDCD', + lightgrey: '#ECECEC', + verylightgrey: '#F6F6F6', + white: '#FAFAFA' + primary: + DEFAULT: '#000000', + light: '#00F2A5', + charcoal: '#373F51', + moonstone: '#58A4B0', + powder: '#A9BCD0', + platinum: '#D8DBE2' + transparent: 'transparent', + current: 'currentColor', + inherit: 'inherit', + error: '#FF5656', + warning: '#FFC85C', + success: '#7BC079', + info: '#333333' + */ + +export const OFFER_CARD_TYPE = { + fill: 'fill', + empty: 'empty' +} as const + +export const OFFER_CARD_TYPES = Object.values(OFFER_CARD_TYPE) +export type OfferCardType = (typeof OFFER_CARD_TYPES)[number] +export const OFFER_CARD_TYPE_DEFAULT = OFFER_CARD_TYPE.empty diff --git a/src/components/Containment/OfferCard/OfferCard.spec.ts b/src/components/Containment/OfferCard/OfferCard.spec.ts new file mode 100644 index 0000000..66bc520 --- /dev/null +++ b/src/components/Containment/OfferCard/OfferCard.spec.ts @@ -0,0 +1,80 @@ +import { mount } from '@vue/test-utils' +import { it, describe, expect } from 'vitest' +import OfferCard from './OfferCard.vue' + +describe('OfferCard.vue', () => { + it('renders correctly when type is empty', () => { + const wrapper = mount(OfferCard, { + props: { + type: 'empty', + title: '', + location: '', + nCandidates: 0, + contractType: '', + contractDuration: '', + id: '', + studentNames: [], + desktopColor: 'transparent' + } + }) + expect(wrapper.find('.h-60').exists()).toBe(true) + expect(wrapper.find('[data-test="create-offer"]').exists()).toBe(true) + }) + + it('renders correctly when type is fill', () => { + const wrapper = mount(OfferCard, { + props: { + type: 'fill', + title: 'Test Title', + location: 'Test Location', + nCandidates: 5, + contractType: 'Test Contract Type', + contractDuration: 'Test Contract Duration', + id: '1', + studentNames: ['John', 'Doe'], + desktopColor: 'error' + } + }) + expect(wrapper.find('.h-60').exists()).toBe(true) + expect(wrapper.find('h4').text()).toBe('Test Title') + expect(wrapper.find('p').text()).toBe('Test Location') + expect(wrapper.findAll('[data-test="avatar"]').length).toBe(2) + }) + + it('emits seeOffer event', async () => { + const wrapper = mount(OfferCard, { + props: { + type: 'fill', + title: 'Test Title', + location: 'Test Location', + nCandidates: 5, + contractType: 'Test Contract Type', + contractDuration: 'Test Contract Duration', + id: '1', + studentNames: ['John', 'Doe'], + desktopColor: 'error' + } + }) + await wrapper.find('button').trigger('click') + expect(wrapper.emitted()).toHaveProperty('seeOffer') + expect(wrapper.emitted().seeOffer[0]).toEqual(['1']) + }) + + it('emits createOffer event', async () => { + const wrapper = mount(OfferCard, { + props: { + type: 'empty', + title: '', + location: '', + nCandidates: 0, + contractType: '', + contractDuration: '', + id: '', + studentNames: [], + desktopColor: 'error' + } + }) + await wrapper.find('[data-test="create-offer"]').trigger('click') + expect(wrapper.emitted()).toHaveProperty('createOffer') + }) +}) diff --git a/src/components/Containment/OfferCard/OfferCard.story.vue b/src/components/Containment/OfferCard/OfferCard.story.vue new file mode 100644 index 0000000..430e785 --- /dev/null +++ b/src/components/Containment/OfferCard/OfferCard.story.vue @@ -0,0 +1,91 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + {}" + @createOffer="() => {}" + /> + + + + + diff --git a/src/components/Containment/OfferCard/OfferCard.vue b/src/components/Containment/OfferCard/OfferCard.vue new file mode 100644 index 0000000..9fc385e --- /dev/null +++ b/src/components/Containment/OfferCard/OfferCard.vue @@ -0,0 +1,113 @@ + + + + + ajouter une offre + + + + + {{ title }} + + {{ location }} + + + + + + + + + + + + + {{ nCandidates }} candidats + + + + Consulter l’espace de l’offre + + + + + + + diff --git a/src/components/Containment/OfferCard/index.ts b/src/components/Containment/OfferCard/index.ts new file mode 100644 index 0000000..62acf6f --- /dev/null +++ b/src/components/Containment/OfferCard/index.ts @@ -0,0 +1 @@ +export { default } from './OfferCard.vue'; diff --git a/src/components/Media/IconsBase/IconsBase.model.ts b/src/components/Media/IconsBase/IconsBase.model.ts index c9b2f87..91949da 100644 --- a/src/components/Media/IconsBase/IconsBase.model.ts +++ b/src/components/Media/IconsBase/IconsBase.model.ts @@ -48,7 +48,8 @@ export const ICONS_NAME = { userCog: 'userCog', userRoundx: 'userRoundx', video: 'video', - dribble: 'dribble' + dribble: 'dribble', + desktop: 'desktop' } as const export const ICONS_NAMES = Object.values(ICONS_NAME) diff --git a/src/components/Media/IconsBase/IconsBase.story.vue b/src/components/Media/IconsBase/IconsBase.story.vue index 7bd279f..ee091e2 100644 --- a/src/components/Media/IconsBase/IconsBase.story.vue +++ b/src/components/Media/IconsBase/IconsBase.story.vue @@ -173,6 +173,9 @@ + + + diff --git a/src/index.ts b/src/index.ts index d8dad39..8b390d2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -17,3 +17,4 @@ export { default as CertifContainer } from './components/Containment/CertifConta export { default as DeleteModal } from './components/Indicators/DeleteModal' export { default as RankingContainer } from './components/Containment/RankingContainer' export { default as SelectField } from './components/CTA/SelectField' +export { default as OfferCard } from './components/Containment/OfferCard'; diff --git a/src/tailwind/presetConfig.ts b/src/tailwind/presetConfig.ts index 20e413b..ec39ca1 100644 --- a/src/tailwind/presetConfig.ts +++ b/src/tailwind/presetConfig.ts @@ -128,5 +128,7 @@ export const colorsPalette = { powder: '#A9BCD0', platinum: '#D8DBE2', error: '#F22B00', - 'error-light': '#00F2A5' + errorLight: '#00F2A5', + lightmoonstone: '#58A4B01A', + warning: '#FFC85C' }
{{ location }}
+ {{ nCandidates }} candidats +