Skip to content
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
4 changes: 2 additions & 2 deletions cypress/integration/Stepper._spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -162,12 +162,12 @@ describe('Stepper.vue', () => {
cy.get('.SA').should('have.class', 'disabled')
cy.hasRecommendedLicense('CC BY-ND 4.0')
cy.window().then(($window) => {
expect($window.scrollY).to.be.closeTo(800, 200)
expect($window.scrollY).to.be.closeTo(800, 300)
})
cy.get('button').contains('DONE').click()
cy.hasLicenseInAttributionCode('CC BY-ND 4.0')
cy.window().then(($window) => {
expect($window.scrollY).to.be.closeTo(1300, 200)
expect($window.scrollY).to.be.closeTo(1400, 300)
})
})
})
Expand Down
3 changes: 0 additions & 3 deletions docs/css/app.9b11c675.css

This file was deleted.

3 changes: 3 additions & 0 deletions docs/css/app.aac5d9bc.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="Want to license your work with Creative Commons, but not sure where to start, or which license is right for you? Use our license chooser!"><link rel="icon" href="/favicon.ico"><link rel="icon" type="image/png" href="https://d15omoko64skxi.cloudfront.net/wp-content/uploads/2016/05/cc-site-icon-300x300.png" sizes="192x192"><link rel="apple-touch-icon-precomposed" href="https://d15omoko64skxi.cloudfront.net/wp-content/uploads/2016/05/cc-site-icon-300x300.png"><meta name="twitter:card" content="summary"><meta name="twitter:site" content="@creativecommons"><meta name="twitter:creator" content="@creativecommons"><meta property="og:url" content="https://beta-chooser.creativecommons.org"><meta property="og:title" content="Choose a License"><meta property="og:type" content="website"><meta property="og:description" content="Want to license your work with Creative Commons, but not sure where to start, or which license is right for you? Use our license chooser!"><meta property="og:image" content="https://mirrors.creativecommons.org/presskit/logos/cc.logo.large.png"><meta property="og:locale" content="en_US"><meta property="og:locale:alternate" content="ru_RU"><title>Choose a License</title><link href="/css/app.9b11c675.css" rel="preload" as="style"><link href="/js/app.a588ff01.js" rel="preload" as="script"><link href="/js/chunk-vendors.fa662221.js" rel="preload" as="script"><link href="/css/app.9b11c675.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but License Chooser doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.fa662221.js"></script><script src="/js/app.a588ff01.js"></script></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width,initial-scale=1"><meta name="description" content="Want to license your work with Creative Commons, but not sure where to start, or which license is right for you? Use our license chooser!"><link rel="icon" href="/favicon.ico"><link rel="icon" type="image/png" href="https://d15omoko64skxi.cloudfront.net/wp-content/uploads/2016/05/cc-site-icon-300x300.png" sizes="192x192"><link rel="apple-touch-icon-precomposed" href="https://d15omoko64skxi.cloudfront.net/wp-content/uploads/2016/05/cc-site-icon-300x300.png"><meta name="twitter:card" content="summary"><meta name="twitter:site" content="@creativecommons"><meta name="twitter:creator" content="@creativecommons"><meta property="og:url" content="https://beta-chooser.creativecommons.org"><meta property="og:title" content="Choose a License"><meta property="og:type" content="website"><meta property="og:description" content="Want to license your work with Creative Commons, but not sure where to start, or which license is right for you? Use our license chooser!"><meta property="og:image" content="https://mirrors.creativecommons.org/presskit/logos/cc.logo.large.png"><meta property="og:locale" content="en_US"><meta property="og:locale:alternate" content="ru_RU"><title>Choose a License</title><link href="/css/app.aac5d9bc.css" rel="preload" as="style"><link href="/js/app.8a1c7fdf.js" rel="preload" as="script"><link href="/js/chunk-vendors.f5ee90ab.js" rel="preload" as="script"><link href="/css/app.aac5d9bc.css" rel="stylesheet"></head><body><noscript><strong>We're sorry but License Chooser doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id="app"></div><script src="/js/chunk-vendors.f5ee90ab.js"></script><script src="/js/app.8a1c7fdf.js"></script></body></html>
2 changes: 2 additions & 0 deletions docs/js/app.8a1c7fdf.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/js/app.8a1c7fdf.js.map

Large diffs are not rendered by default.

2 changes: 0 additions & 2 deletions docs/js/app.a588ff01.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/js/app.a588ff01.js.map

This file was deleted.

62 changes: 62 additions & 0 deletions docs/js/chunk-vendors.f5ee90ab.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions docs/js/chunk-vendors.f5ee90ab.js.map

Large diffs are not rendered by default.

62 changes: 0 additions & 62 deletions docs/js/chunk-vendors.fa662221.js

This file was deleted.

1 change: 0 additions & 1 deletion docs/js/chunk-vendors.fa662221.js.map

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"@fullhuman/postcss-purgecss": "^3.1.3",
"@linusborg/vue-simple-portal": "^0.1.4",
"@sentry/vue": "^5.29.2",
"buefy": "^0.9.4",
"bulma": "^0.9.1",
"clipboard": "^2.0.6",
"core-js": "^3.6.5",
"markdown-it": "^12.0.3",
Expand Down
226 changes: 226 additions & 0 deletions src/Vocabulary/VInput.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
<template>
<div
:class="['control', sizeClass, {
'has-icons-left': hasLeftIcon,
'has-icons-right': hasRightIcon
}]"
>
<label :class="[sizeClass]">
<span
v-if="label"
class="label"
>{{ label }}
<span
v-if="description"
class="description"
>{{ description }}</span>
</span>
<span :class="['control-inner', { 'disabled': isDisabled, 'readonly': isReadonly}]">
<span
v-if="hasLeftIcon"
class="icon left-icon"
>
<slot name="left-icon" />
</span>
<input
v-if="!isTextArea"
class="input"
:class="[sizeClass]"
:placeholder="placeholder"
:disabled="isDisabled"
:type="type"
:value="localValue"
@input="onInput"
>
<textarea
v-if="isTextArea"
class="textarea"
:value="localValue"
:placeholder="placeholder"
:disabled="isDisabled"
:readonly="isReadonly"
@input="onInput"
/>
<span
v-if="hasRightIcon"
class="icon right-icon"
>
<slot name="right-icon" />
</span>
</span>
</label>
</div>
</template>
<script>
export default {
name: 'VInput',
props: {
value: {
type: String,
default: ''
},
type: {
type: String,
default: 'text'
},
label: {
type: String,
default: ''
},
description: {
type: String,
default: ''
},
placeholder: {
type: String,
default: ''
},
Comment on lines +58 to +77
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use inheritAttrs: false and then place the $attrs on the input. See docs.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for a late reply, @dhruvkb ! I was writing this component as a more general Input component for Vocabulary that can be a text input or a text area. The solution you propose is really clean, but for a simpler component.

Some of these props, such as description, label, value are necessary for the component itself, and some could be bound to the input or the textarea, so I thought leaving them as props would be better.

isTextArea: {
type: Boolean,
default: false
},
isReadonly: {
type: Boolean,
default: false
},
isDisabled: {
type: Boolean,
default: false
},
size: {
type: String,
default: 'is-normal',
validate: function(value) {
return ['is-normal', 'is-medium', 'is-large'].indexOf(value) > -1
}
}
},
data() {
return {
localValue: this.value
}
},
computed: {
computedValue: {
get() {
return this.localValue
},
set(newVal) {
this.localValue = newVal
this.$emit('input', newVal)
}
},
sizeClass() {
return this.size === 'normal' ? '' : this.size
},
hasLeftIcon() {
// Check if the 'left-icon' slot has content, return a boolean value
return !!this.$slots['left-icon']
},
hasRightIcon() {
// Check if the 'right-icon' slot has content, return a boolean value
return !!this.$slots['right-icon']
}
},
methods: {
onInput(event) {
this.localValue = event.target.value
this.computedValue = event.target.value
}
}
}
// <!--'', is-medium, is-large in vocabulary; normal, big, huge in DL-->

</script>

<style lang="scss" scoped >
@import "~@creativecommons/vocabulary/scss/color.scss";
@import "~@creativecommons/vocabulary/scss/typography.scss";
.input, .textarea {
border: none;
&:hover, &:active, &:focus {
border-color: $color-gray;
}
}

label {
&.is-medium {
.label, .description {
font-size: $font-size-body-bigger;
}
}
}
.label, .description {
display: block;
margin-bottom: 0.5rem;
}
.label {
font-weight: bold;
}
.description {
font-weight: normal;
}
.control {
.control-inner {
border: 0.125rem solid $color-light-gray;
border-radius: 4px;
background-color: white;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
&:hover:not(.disabled):not(.readonly),
&:active:not(.disabled):not(.readonly),
&:focus:not(.disabled):not(.readonly) {
border-color: $color-gray;
.icon {
color: $color-gray;
}
}
&.disabled {
background-color: $color-lighter-gray;
textarea {
background-color: $color-lighter-gray;
}
}
}
.input {
width: 100%;
padding-left: 1rem;
padding-right: 1rem;
border-color: transparent;
margin-top: 0;
}

.icon {
position: static;
height: 1.25rem;
width: 1.25rem;
&.left-icon {
margin-left: 1rem;
}
&.right-icon {
margin-right: 1rem;
}
.icon-img {
height: auto;
width: 100%;
pointer-events: none;
cursor: unset;
&.clickable {
pointer-events: auto;
cursor: pointer;
}
}
}

}
.control.is-large {
.left-icon {
margin-left: 1.5rem;
}
.right-icon {
margin-right: 1.5rem;
}
}
</style>
91 changes: 33 additions & 58 deletions src/components/AttributionDetailsStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,39 +4,45 @@
{{ $t('stepper.AD.instructions') }}
</p>
<form class="attribution-details-form">
<b-field :label="$t('stepper.AD.form.work-title.label')">
<b-input
v-model="workTitle"
:placeholder="$t('stepper.AD.form.work-title.placeholder')"
/>
</b-field>
<b-field :label="$t('stepper.AD.form.creator-name.label')">
<b-input
v-model="creatorName"
:placeholder="$t('stepper.AD.form.creator-name.placeholder')"
/>
</b-field>
<b-field :label="$t('stepper.AD.form.work-url.label')">
<b-input
v-model="workUrl"
:placeholder="$t('stepper.AD.form.work-url.placeholder')"
/>
</b-field>
<b-field :label="$t('stepper.AD.form.creator-profile.label')">
<b-input
v-model="creatorProfileUrl"
:placeholder="$t('stepper.AD.form.creator-profile.placeholder')"
/>
</b-field>
<v-input
v-model="workTitle"
:label="$t('stepper.AD.form.work-title.label')"
:placeholder="$t('stepper.AD.form.work-title.placeholder')"
/>
<v-input
v-model="creatorName"
:label="$t('stepper.AD.form.creator-name.label')"
:placeholder="$t('stepper.AD.form.creator-name.placeholder')"
/>
<v-input
v-model="workUrl"
:label="$t('stepper.AD.form.work-url.label')"
:placeholder="$t('stepper.AD.form.work-url.placeholder')"
/>
<v-input
v-model="creatorProfileUrl"
:label="$t('stepper.AD.form.creator-profile.label')"
:placeholder="$t('stepper.AD.form.creator-profile.placeholder')"
/>
</form>
</div>
</template>
<script>
import { mapMutations, mapState } from 'vuex'
import VInput from '@/Vocabulary/VInput'

export default {
name: 'AttributionDetails',
components: { VInput },
inheritAttrs: false,
props: {
status: {
type: String,
validator(value) {
return ['active', 'previous', 'inactive'].includes(value)
}
}
},
computed: {
...mapState(['attributionDetails']),
creatorName: {
Expand Down Expand Up @@ -72,40 +78,9 @@ export default {
</script>
<style lang="scss">
.attribution-details-form {
margin-top: 1rem;
}

.attribution-details-form .label {
font-style: normal;
font-weight: normal;
font-size: 1rem;
line-height: 1.5rem;
color: #333333;
}
.attribution-details-form .input {
font-weight: 600;
font-size: 1rem;
color: #333333;
border-width: 2px;
border-color: #d8d8d8;
&:focus, &:active, &:hover {
border-color: #b0b0b0;
}
}
@media only screen and (max-width: 768px) {
.attribution-details-form .label {
font-style: normal;
font-size: 0.8125rem;
line-height: 1.1875rem;
font-weight: 600;
color: #333333;
}
.attribution-details-form input[type="text"] {
font-style: normal;
font-size: 0.8125rem;
line-height: 1.1875rem;
font-weight: 600;
color: #333333;
margin-top: 1.5rem;
.control + .control {
margin-top: 1rem;
}
}
</style>
2 changes: 0 additions & 2 deletions src/main.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import Vue from 'vue'
import Buefy from 'buefy'
import VueVocabulary from '@creativecommons/vue-vocabulary/vue-vocabulary.common.js'
import i18n from './i18n'
import App from './App.vue'
Expand All @@ -13,7 +12,6 @@ import Hotjar from 'vue-hotjar'
import VueAnalytics from 'vue-analytics'

Vue.config.productionTip = false
Vue.use(Buefy)
Vue.use(VueVocabulary)
Vue.use(VueScrollTo)

Expand Down
2 changes: 0 additions & 2 deletions tests/unit/specs/components/AttributionDetailsStep.spec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import { createLocalVue, mount } from '@vue/test-utils'
import Buefy from 'buefy'
import Vuex from 'vuex'
import AttributionDetailsStep from '@/components/AttributionDetailsStep'

const localVue = createLocalVue()

localVue.use(Vuex)
localVue.use(Buefy)

describe('AttributionDetailsStep Component Rendering', () => {
let wrapper
Expand Down
Loading