Skip to content

Commit

Permalink
Move components
Browse files Browse the repository at this point in the history
  • Loading branch information
cretueusebiu committed Jan 22, 2018
1 parent 102f450 commit c6aa8db
Show file tree
Hide file tree
Showing 8 changed files with 26 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'btn-lg': large,
'btn-loading': loading
}">
<slot></slot>
<slot/>
</button>
</template>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</div>

<div class="card-body">
<slot></slot>
<slot/>
</div>
</div>
</template>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
:id="id || name || 'checkbox'"
>
<label class="custom-control-label" :for="id || name || 'checkbox'">
<slot></slot>
<slot/>
</label>
</div>
</template>
Expand Down
2 changes: 1 addition & 1 deletion resources/assets/js/components/Loading.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
height: height,
opacity: show ? 1 : 0,
'background-color': canSuccess ? color : failedColor
}"></div>
}"/>
</template>

<script>
Expand Down
40 changes: 14 additions & 26 deletions resources/assets/js/components/index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,17 @@
import Vue from 'vue'
import Card from './Card'
import Button from './Button'
import Checkbox from './Checkbox'
import { HasError, AlertError, AlertSuccess } from 'vform'

Vue.component(HasError.name, HasError)
Vue.component(AlertError.name, AlertError)
Vue.component(AlertSuccess.name, AlertSuccess)

/**
* @param {Object} requireContext
*/
const registerComponents = requireContext => {
requireContext.keys().forEach(file => {
let component = requireContext(file)

if (component.default) {
component = component.default
}

if (component.name !== undefined) {
Vue.component(component.name, component)
}
})
}

// Load global components dynamically
registerComponents(require.context('./global', false, /.*\.(js|vue)$/))

// Load layout components dynamically
registerComponents(require.context('./layouts', false, /.*\.(js|vue)$/))
// Components that are registered globaly.
[
Card,
Button,
Checkbox,
HasError,
AlertError,
AlertSuccess
].forEach(Component => {
Vue.component(Component.name, Component)
})
4 changes: 4 additions & 0 deletions resources/assets/js/pages/auth/login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,13 @@

<script>
import Form from 'vform'
import LoginWithGithub from '~/components/LoginWithGithub'
export default {
middleware: 'guest',
components: {
LoginWithGithub
},
metaInfo () {
return { title: this.$t('login') }
Expand Down
4 changes: 4 additions & 0 deletions resources/assets/js/pages/auth/register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -64,9 +64,13 @@

<script>
import Form from 'vform'
import LoginWithGithub from '~/components/LoginWithGithub'
export default {
middleware: 'guest',
components: {
LoginWithGithub
},
metaInfo () {
return { title: this.$t('register') }
Expand Down

0 comments on commit c6aa8db

Please sign in to comment.