Skip to content

Commit

Permalink
Clean up scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiandedeyne committed Apr 26, 2019
1 parent 968dce7 commit 1845177
Show file tree
Hide file tree
Showing 8 changed files with 17 additions and 30 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
"@babel/plugin-syntax-dynamic-import": "^7.2.0",
"@babel/preset-react": "^7.0.0",
"cross-env": "^5.1",
"laravel-javascript-views": "^0.2.1",
"laravel-mix": "^4.0.7",
"laravel-mix-purgecss": "^4.1.0",
"postcss-easy-import": "^3.0.0",
Expand Down
29 changes: 12 additions & 17 deletions resources/js/app.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
import Views from 'laravel-javascript-views/react';

const views = new Views();

views.context(() => {
const context = require.context('./components', true, /\.js$/i);

if (module.hot) {
module.hot.accept(context.id, () => {
views.reload();
});
}

return context;
});

views.mount();
import { render } from 'react-dom';
import SpeakersInput from './components/SpeakersInput';
import TracksInput from './components/TracksInput';

function mount(componentName, Component) {
[...document.querySelectorAll(`[data-component=${componentName}]`)].forEach(container => {
render(<Component {...JSON.parse(container.dataset.props)} />, container);
});
}

mount('SpeakersInput', SpeakersInput);
mount('TracksInput', TracksInput);
File renamed without changes.
File renamed without changes.
10 changes: 4 additions & 6 deletions resources/js/components/SpeakersInput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Repeater from '../lib/components/Repeater';
import Repeater from './Repeater';

export default function SpeakersInput({ initialSpeakers, errors }) {
return (
Expand All @@ -15,20 +15,18 @@ export default function SpeakersInput({ initialSpeakers, errors }) {
type="text"
name={`speakers[${index}][name]`}
value={item.name}
readOnly={! item.editable}
readOnly={!item.editable}
onChange={event => update({ ...item, name: event.target.value })}
/>
<label>Email</label>
<input
type="email"
name={`speakers[${index}][email]`}
value={item.email}
readOnly={! item.editable}
readOnly={!item.editable}
onChange={event => update({ ...item, email: event.target.value })}
/>
{item.editable === false && (
<strong>Has account</strong>
)}
{item.editable === false && <strong>Has account</strong>}
<button type="button" onClick={remove}>
Remove
</button>
Expand Down
2 changes: 1 addition & 1 deletion resources/js/components/TracksInput.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Repeater from '../lib/components/Repeater';
import Repeater from './Repeater';

export default function TracksInput({ initialTracks, errors }) {
return (
Expand Down
File renamed without changes.
5 changes: 0 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3734,11 +3734,6 @@ kind-of@^6.0.0, kind-of@^6.0.2:
resolved "https://registry.yarnpkg.com/kind-of/-/kind-of-6.0.2.tgz#01146b36a6218e64e58f3a8d66de5d7fc6f6d051"
integrity sha512-s5kLOcnH0XqDO+FvuaLX8DDjZ18CGFk7VygH40QoKPUQhW4e2rvM0rwUq0t8IQDOwYSeLK01U90OjzBTme2QqA==

laravel-javascript-views@^0.2.1:
version "0.2.4"
resolved "https://registry.yarnpkg.com/laravel-javascript-views/-/laravel-javascript-views-0.2.4.tgz#edc25a15974a1240cc96560f3f2f309aabca769a"
integrity sha512-gT6pDymzpYBFv5oL4rGi5UKAiwqP4BQERwTXHliU1JAHifH+bqiHJMyn1UCfLb82l8aJgOCQcSjF+TyoKRoFCA==

laravel-mix-purgecss@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/laravel-mix-purgecss/-/laravel-mix-purgecss-4.1.0.tgz#1aaea75948d80d3035041c65af4e55c921acee83"
Expand Down

0 comments on commit 1845177

Please sign in to comment.