Merge branch 'master' of github.com:Human-Connection/Nitro-Web into 37-full-text-search-top-bar

This commit is contained in:
Matt Rider 2019-03-01 14:26:03 -03:00
commit cba5e10397
9 changed files with 64 additions and 23 deletions

View File

@ -42,13 +42,16 @@ $ yarn start
## Styleguide
All reusable Components (for example avatar) should be done inside the styleguide directory.
All reusable Components (for example avatar) should be done inside the [Nitro-Styleguide](https://github.com/Human-Connection/Nitro-Styleguide) repository.
![Styleguide Screenshot](screenshot-styleguide.png)
More information can be found here: https://github.com/Human-Connection/Nitro-Styleguide
If you need to change something in the styleguide and want to see the effects on the frontend immediately, then we have you covered.
You need to clone the styleguide to the parent directory `../Nitro-Styleguide` and run `yarn && yarn run dev`. After that you run `yarn run dev:styleguide` instead of `yarn run dev` and you will see your changes reflected inside the fronten!
## Internationalization (i18n)
You can help translating the interface by joining us on [lokalise.co](https://lokalise.co/public/556252725c18dd752dd546.13222042/).

View File

@ -1,5 +1,8 @@
import { shallowMount, mount } from '@vue/test-utils'
import SearchInput from './SearchInput.vue'
import Vue from 'vue'
import Styleguide from '@human-connection/styleguide'
Vue.use(Styleguide)
describe('SearchInput.vue', () => {
let wrapper
@ -28,10 +31,12 @@ describe('SearchInput.vue', () => {
})
it('changes searchValue as a user inputs a value', () => {
wrapper = shallowMount(SearchInput, { mocks })
let input = wrapper.find('#nav-search')
input.element.value = 'abc'
input.trigger('input')
expect(wrapper.vm.value).toBe('abc')
wrapper = mount(SearchInput, { mocks })
console.log(wrapper.html())
let input = wrapper.find('input#nav-search')
console.log(input)
input.trigger('focus')
input.setValue('abc')
expect(wrapper.vm.searchValue).toBe('abc')
})
})

View File

@ -11,5 +11,5 @@ Feature: Search
Scenario: Search for specific words
Given I am logged in
When I search for a specific word
When I search for "Essays"
Then I should see posts with that word included

View File

@ -1,9 +1,9 @@
import { When, Then } from 'cypress-cucumber-preprocessor/steps'
When('I search for a specific word', () => {
When('I search for {string}', value => {
cy.get('#nav-search')
.focus()
.type('Essays')
.type(value)
})
Then('I should see posts with that word included', () => {

View File

@ -1,7 +1,14 @@
const pkg = require('./package')
const envWhitelist = ['NODE_ENV', 'MAINTENANCE', 'MAPBOX_TOKEN']
const dev = process.env.NODE_ENV !== 'production'
const path = require('path')
const styleguidePath = '../Nitro-Styleguide'
const styleguideStyles = process.env.STYLEGUIDE_DEV
? [
`${styleguidePath}/src/system/styles/main.scss`,
`${styleguidePath}/src/system/styles/shared.scss`
]
: '@human-connection/styleguide/dist/shared.scss'
module.exports = {
mode: 'universal',
@ -9,7 +16,7 @@ module.exports = {
dev: dev,
debug: dev ? 'nuxt:*,app' : null,
modern: 'server',
modern: !dev ? 'server' : false,
transition: {
name: 'slide-up',
@ -66,11 +73,22 @@ module.exports = {
** Global CSS
*/
css: ['~assets/styles/main.scss'],
/*
** Global processed styles
*/
styleResources: {
scss: styleguideStyles
},
/*
** Plugins to load before mounting the App
*/
plugins: [
{ src: '~/plugins/styleguide.js', ssr: true },
{
src: `~/plugins/styleguide${process.env.STYLEGUIDE_DEV ? '-dev' : ''}.js`,
ssr: true
},
{ src: '~/plugins/i18n.js', ssr: true },
{ src: '~/plugins/axios.js', ssr: false },
{ src: '~/plugins/keep-alive.js', ssr: false },
@ -102,10 +120,6 @@ module.exports = {
'portal-vue/nuxt'
],
styleResources: {
scss: ['@human-connection/styleguide/dist/shared.scss']
},
/*
** Axios module configuration
*/
@ -180,6 +194,20 @@ module.exports = {
exclude: /(node_modules)/
})
}
if (process.env.STYLEGUIDE_DEV) {
const path = require('path')
config.resolve.alias['@@'] = path.resolve(
__dirname,
`${styleguidePath}/src/system`
)
config.module.rules.push({
resourceQuery: /blockType=docs/,
loader: require.resolve(
`${styleguidePath}/src/loader/docs-trim-loader.js`
)
})
}
const svgRule = config.module.rules.find(rule => rule.test.test('.svg'))
svgRule.test = /\.(png|jpe?g|gif|webp)$/
config.module.rules.push({

View File

@ -6,12 +6,11 @@
"private": true,
"scripts": {
"dev": "cross-env NODE_ENV=development nodemon server/index.js --watch server",
"dev:styleguide": "cross-env STYLEGUIDE_DEV=true yarn dev",
"build": "nuxt build",
"start": "cross-env node server/index.js",
"generate": "nuxt generate",
"lint": "eslint --ext .js,.vue .",
"styleguide": "echo 'Command styleguide is Deprecated!'",
"styleguide:build": "echo 'Command styleguide:build is Deprecated!'",
"test": "jest",
"precommit": "yarn lint",
"e2e:local": "cypress run --headed",
@ -56,6 +55,9 @@
"nuxt": "~2.4.5",
"nuxt-env": "~0.1.0",
"portal-vue": "~1.5.1",
"@human-connection/styleguide": "~0.5.2",
"v-tooltip": "~2.0.0-rc.33",
"vue-count-to": "~1.0.13",
"string-hash": "^1.1.3",
"tiptap": "^1.13.0",
"tiptap-extensions": "^1.13.0",

View File

@ -0,0 +1,4 @@
import Vue from 'vue'
import Styleguide from '@@'
Vue.use(Styleguide)

View File

@ -1,6 +1,5 @@
import Vue from 'vue'
import Styleguide from '@human-connection/styleguide'
import '@human-connection/styleguide/dist/system.css'
// import '@human-connection/styleguide/dist/shared.scss'
Vue.use(Styleguide)

View File

@ -894,10 +894,10 @@
debug "^3.1.0"
lodash.once "^4.1.1"
"@human-connection/styleguide@~0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@human-connection/styleguide/-/styleguide-0.5.0.tgz#14d5f696461996708b25126dc1e9e900c3a841cf"
integrity sha512-xR8iqGnjxGABoSI3AIq2R9YibZi4TTIe5R6/A9cEbWo3XqD/82+tNBjyKhv84Op4KJTgedR6IJtIIOh3H0aeOg==
"@human-connection/styleguide@~0.5.2":
version "0.5.2"
resolved "https://registry.yarnpkg.com/@human-connection/styleguide/-/styleguide-0.5.2.tgz#a7d05b612562cfbe4377032bdf32df4a8f0e3f45"
integrity sha512-8RSQDv6hRvdToQKtOGv+aNA/lfrNu+eNDy/JBaynJN7bB7veNgQ0XGt9Otq1KmdW2nthWrwsnZLTRaUaGqyAZw==
dependencies:
portal-vue "~1.5.1"
vue "~2.6.7"