Add a login form
This commit is contained in:
parent
eff637ffa5
commit
5553334654
@ -1,11 +1,12 @@
|
|||||||
import m from "mithril";
|
import m from "mithril";
|
||||||
import { MessageBox } from "./MessageBox";
|
import { MessageBox } from "./MessageBox";
|
||||||
|
import { LoginForm } from "./Login";
|
||||||
|
|
||||||
export const ChatApp = {
|
export const ChatApp = {
|
||||||
view: function () {
|
view: function () {
|
||||||
return m("div", { class: "container" }, [
|
return m("div", { class: "container" }, [
|
||||||
m("h1", "A Stupid Chat Application"),
|
m("h1", "A Stupid Chat Application"),
|
||||||
m(MessageBox)
|
m(LoginForm)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
11
chat-app/src/components/Login.js
Normal file
11
chat-app/src/components/Login.js
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import m from "mithril";
|
||||||
|
|
||||||
|
export const LoginForm = {
|
||||||
|
view: function() {
|
||||||
|
return m("form", { action: "/login" }, [
|
||||||
|
m("label", { for: "username" }, "Username"),
|
||||||
|
m("input", { type: "text", name: "username" }),
|
||||||
|
m("input", { type: "submit", value: "Login" })
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
};
|
@ -1,4 +1,8 @@
|
|||||||
import m from "mithril";
|
import m from "mithril";
|
||||||
import { ChatApp } from "./ChatApp";
|
import { ChatApp } from "./ChatApp";
|
||||||
|
|
||||||
|
const localState = {
|
||||||
|
messages: []
|
||||||
|
}
|
||||||
|
|
||||||
m.mount(document.getElementById("app"), ChatApp);
|
m.mount(document.getElementById("app"), ChatApp);
|
||||||
|
@ -1717,28 +1717,35 @@ var require_mithril = __commonJS((exports, module) => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
// src/components/index.js
|
// src/components/index.js
|
||||||
var import_mithril3 = __toESM(require_mithril(), 1);
|
var import_mithril4 = __toESM(require_mithril(), 1);
|
||||||
|
|
||||||
// src/components/ChatApp.js
|
// src/components/ChatApp.js
|
||||||
var import_mithril2 = __toESM(require_mithril(), 1);
|
var import_mithril3 = __toESM(require_mithril(), 1);
|
||||||
|
|
||||||
// src/components/MessageBox.js
|
// src/components/MessageBox.js
|
||||||
var import_mithril = __toESM(require_mithril(), 1);
|
var import_mithril = __toESM(require_mithril(), 1);
|
||||||
var MessageBox = {
|
|
||||||
|
// src/components/Login.js
|
||||||
|
var import_mithril2 = __toESM(require_mithril(), 1);
|
||||||
|
var LoginForm = {
|
||||||
view: function() {
|
view: function() {
|
||||||
return import_mithril.default("div", { id: "message-box" }, "Do Something");
|
return import_mithril2.default("form", { action: "/login" }, [
|
||||||
|
import_mithril2.default("label", { for: "username" }, "Username"),
|
||||||
|
import_mithril2.default("input", { type: "text", name: "username" }),
|
||||||
|
import_mithril2.default("input", { type: "submit", value: "Login" })
|
||||||
|
]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// src/components/ChatApp.js
|
// src/components/ChatApp.js
|
||||||
var ChatApp = {
|
var ChatApp = {
|
||||||
view: function() {
|
view: function() {
|
||||||
return import_mithril2.default("div", { class: "container" }, [
|
return import_mithril3.default("div", { class: "container" }, [
|
||||||
import_mithril2.default("h1", "A Stupid Chat Application"),
|
import_mithril3.default("h1", "A Stupid Chat Application"),
|
||||||
import_mithril2.default(MessageBox)
|
import_mithril3.default(LoginForm)
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// src/components/index.js
|
// src/components/index.js
|
||||||
import_mithril3.default.mount(document.getElementById("app"), ChatApp);
|
import_mithril4.default.mount(document.getElementById("app"), ChatApp);
|
||||||
|
Loading…
Reference in New Issue
Block a user