Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement Section, Loading and emptyState #17

Merged
merged 9 commits into from
Aug 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
168 changes: 84 additions & 84 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

82 changes: 82 additions & 0 deletions src/assets/svg/empty-state.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
14 changes: 14 additions & 0 deletions src/assets/svg/spinner.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 15 additions & 0 deletions src/components/EmptyState/WEmptyState.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import WEmptyState from './WEmptyState.vue'

describe('WEmptyState', () => {
it('renders properly', () => {
const wrapper = mount(WEmptyState, {
props: {
text: 'Empty state'
}
})

expect(wrapper.element).toMatchSnapshot()
})
})
26 changes: 26 additions & 0 deletions src/components/EmptyState/WEmptyState.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { Meta, StoryObj } from '@storybook/vue3'
import WEmptyState from './WEmptyState.vue'

const meta: any = {
title: 'Example/WEmptyState',
component: WEmptyState,
tags: ['autodocs'],
argTypes: {},
args: {}
} satisfies Meta<typeof WEmptyState>

export default meta
type Story = StoryObj<typeof meta>

export const Default: Story = {
render: (args: any) => ({
components: { WEmptyState },
setup() {
return { args }
},
template: `<WEmptyState v-bind="args" />`
}),
args: {
text: 'Empty state text'
}
}
16 changes: 16 additions & 0 deletions src/components/EmptyState/WEmptyState.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<template>
<div class="grid gap-md justify-center align-middle">
<EmptyStateLogo class="w-max" />
<p>{{ text }}</p>
</div>
</template>

<script setup lang="ts">
import EmptyStateLogo from '@/assets/svg/empty-state.svg?component'
defineProps({
text: {
type: String,
required: true
}
})
</script>
164 changes: 164 additions & 0 deletions src/components/EmptyState/__snapshots__/WEmptyState.spec.ts.snap

Large diffs are not rendered by default.

36 changes: 17 additions & 19 deletions src/components/Footer/WFooter.vue
Original file line number Diff line number Diff line change
Expand Up @@ -44,25 +44,23 @@
<WitOracleIcon class="w-[140px] h-auto white" name="witnet_dark" />
<div class="h-max self-center">
<p class="copyright max-w-100 footer-text">
© <span>2018-{{ new Date().getFullYear() }}</span
>
<slot name="custom-contributors">
<span>
by <a :href=WITNET_FOUNDATION_URL target="_blank">
Witnet Foundation
</a> and individual contributors.
</span>
</slot>
© <span>2018-{{ new Date().getFullYear() }}</span>
<slot name="custom-contributors">
<span>
by <a :href="WITNET_FOUNDATION_URL" target="_blank"> Witnet Foundation </a> and
individual contributors.
</span>
</slot>
</p>
<p class="copyright max-w-100 footer-text">
<slot name="custom-license">
<span>
Content available under a
<a :href="CREATIVE_COMMONS_URL" target="_blank"> Creative Commons License </a>
.
</span>
</slot>
</p>
<p class="copyright max-w-100 footer-text"><slot name="custom-license">
<span>
Content available under a
<a :href=CREATIVE_COMMONS_URL target="_blank">
Creative Commons License
</a>
.
</span>
</slot></p>
</div>
<!-- <client-only>
<LanguageSwitcher class="justify-self-end self-center" />
Expand Down Expand Up @@ -92,6 +90,6 @@ defineProps({
adoDescription: {
type: String,
default: `Witnet is part of the Alliance of Decentralized Oracles (ADO), a joint effort by leading decentralized oracle solutions to make the life of smart contract developers easier by creating oracle standards. Learn more about the ADO at`
},
}
})
</script>
17 changes: 17 additions & 0 deletions src/components/LoadingPlaceholder/WLoadingPlaceholder.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import WLoadingPlaceholder from './WLoadingPlaceholder.vue'

describe('WLoadingPlaceholder', () => {
it('renders properly', () => {
const wrapper = mount(WLoadingPlaceholder, {
props: {
height: '100px',
width: '150px',
borderRadius: '8%'
}
})

expect(wrapper.element).toMatchSnapshot()
})
})
28 changes: 28 additions & 0 deletions src/components/LoadingPlaceholder/WLoadingPlaceholder.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import type { Meta, StoryObj } from '@storybook/vue3'
import WLoadingPlaceholder from './WLoadingPlaceholder.vue'

const meta: any = {
title: 'Example/WLoadingPlaceholder',
component: WLoadingPlaceholder,
tags: ['autodocs'],
argTypes: {},
args: {}
} satisfies Meta<typeof WLoadingPlaceholder>

export default meta
type Story = StoryObj<typeof meta>

export const Default: Story = {
render: (args: any) => ({
components: { WLoadingPlaceholder },
setup() {
return { args }
},
template: `<WLoadingPlaceholder v-bind="args" />`
}),
args: {
height: '100px',
width: '150px',
borderRadius: '8%'
}
}
40 changes: 40 additions & 0 deletions src/components/LoadingPlaceholder/WLoadingPlaceholder.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<template>
<div
class="placeholder bg-gray-50 bg-opacity-60 bg-gradient-to-r from-gray-50 shadow-sm shadow-gray-100 bg-[length:200%_200%]"
>
&nbsp;
</div>
<span class="sr-only">Loading...</span>
</template>
<script setup>
defineProps({
height: {
type: String,
required: true
},
width: {
type: String,
required: true
},
borderRadius: {
type: String,
required: true
}
})
</script>
<style scoped lang="scss">
@keyframes bgAnimate {
0% {
background-position: 50% 0;
}
100% {
background-position: -150% 0;
}
}
.placeholder {
height: v-bind(height);
width: v-bind(width);
border-radius: v-bind(borderRadius);
gabaldon marked this conversation as resolved.
Show resolved Hide resolved
animation: bgAnimate 1.2s linear infinite;
}
</style>
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`WLoadingPlaceholder > renders properly 1`] = `
<div
data-v-app=""
>

<div
class="placeholder bg-gray-50 bg-opacity-60 bg-gradient-to-r from-gray-50 shadow-sm shadow-gray-100 bg-[length:200%_200%]"
data-v-bd9b9d04=""
>

</div>
<span
class="sr-only"
data-v-bd9b9d04=""
>
Loading...
</span>

</div>
`;
35 changes: 35 additions & 0 deletions src/components/Navbar/WNavbar.stories.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,41 @@ export const Navbar: Story = {
rel: 'buy',
locale: 'buy'
},
{
key: 'build',
active: false,
to: '/build',
rel: 'build',
locale: 'build'
},
{
key: 'build',
active: false,
to: '/build',
rel: 'build',
locale: 'build'
},
{
key: 'build',
active: false,
to: '/build',
rel: 'build',
locale: 'build'
},
{
key: 'build',
active: false,
to: '/build',
rel: 'build',
locale: 'build'
},
{
key: 'build',
active: false,
to: '/build',
rel: 'build',
locale: 'build'
},
{
key: 'build',
active: false,
Expand Down
20 changes: 20 additions & 0 deletions src/components/Section/WSection.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { describe, it, expect } from 'vitest'
import { h } from 'vue'
import { mount } from '@vue/test-utils'
import WSection from './WSection.vue'

describe('WSection', () => {
it('renders properly', () => {
const wrapper = mount(WSection, {
props: {
frameClasses: 'bg-black-950',
contentClasses: 'grid justify-items-center'
},
slots: {
content: h('p', 'Section content')
}
})

expect(wrapper.element).toMatchSnapshot()
})
})
31 changes: 31 additions & 0 deletions src/components/Section/WSection.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import type { Meta, StoryObj } from '@storybook/vue3'
import WSection from './WSection.vue'

const meta: any = {
title: 'Example/WSection',
component: WSection,
tags: ['autodocs'],
argTypes: {},
args: {}
} satisfies Meta<typeof WSection>

export default meta
type Story = StoryObj<typeof meta>

export const Default: Story = {
render: (args: any) => ({
components: { WSection },
setup() {
return { args }
},
template: `<WSection v-bind="args">
<template #content>
<p class="text-white-50">Section content<p>
</template>
</WSection>`
}),
args: {
frameClasses: 'bg-black-950',
contentClasses: 'grid justify-items-center'
}
}
17 changes: 17 additions & 0 deletions src/components/Section/__snapshots__/WSection.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`WSection > renders properly 1`] = `
<div
class="w-full h-full bg-black-950"
>
<div
class="content p-[100px] m-[0_auto] max-w-[1100px] w-full sm:p-[70px_32px] xs:p-[70px_16px] z-50 grid justify-items-center"
>

<p>
Section content
</p>

</div>
</div>
`;
15 changes: 15 additions & 0 deletions src/components/Spinner/WSpinner.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { describe, it, expect } from 'vitest'
import { mount } from '@vue/test-utils'
import WSpinner from './WSpinner.vue'

describe('WSpinner', () => {
it('renders properly', () => {
const wrapper = mount(WSpinner, {
props: {
size: '16px'
}
})

expect(wrapper.element).toMatchSnapshot()
})
})
26 changes: 26 additions & 0 deletions src/components/Spinner/WSpinner.stories.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import type { Meta, StoryObj } from '@storybook/vue3'
import WSpinner from './WSpinner.vue'

const meta: any = {
title: 'Example/WSpinner',
component: WSpinner,
tags: ['autodocs'],
argTypes: {},
args: {}
} satisfies Meta<typeof WSpinner>

export default meta
type Story = StoryObj<typeof meta>

export const Default: Story = {
render: (args: any) => ({
components: { WSpinner },
setup() {
return { args }
},
template: `<WSpinner v-bind="args" />`,
args: {
size: '30px'
}
})
}
Loading