Verified Commit 5678d1ed authored by Jakob Moser's avatar Jakob Moser
Browse files

Start migrating to re-use components

parent de50616c
Loading
Loading
Loading
Loading
+18 −11
Changes for js/components/pages/Portal.mjs: 18 added lines, 11 removed lines.
Original line number Diff line number Diff line
import { Service } from "../pieces/Service.mjs"
import { Base } from "./Base.mjs"

export const Portal = {
@@ -7,11 +8,14 @@ export const Portal = {
    view() {
        return m(
            Base,
            m.trust(`<article class="tools">
        <div class="tool">
            <a class="box btn" target="_blank" href="https://fachschaft.cl.uni-heidelberg.de/meet"><i class="fa-solid fa-phone-volume"></i> Meeting</a>
        </div>

            m("article.tools", [
                m(Service, {
                    href: "https://fachschaft.cl.uni-heidelberg.de/meet",
                    icon: "fa-solid fa-phone-volume",
                    label: "Meeting",
                }),
                m.trust(
                    `
                <div class="tool">
                    <a class="box btn" target="_blank" href="https://fachschaft.cl.uni-heidelberg.de/tickets"><i class="fa-regular fa-envelope"></i> Tickets</a>
                    <span class="detail"><i class="fa-regular fa-user"></i> CL-Account</span>
@@ -34,12 +38,15 @@ export const Portal = {
                    <a class="box btn" target="_blank" href="https://fachschaft.cl.uni-heidelberg.de/protokolle"><i class="fa-regular fa-note-sticky"></i> Protokolle</a>
                    <span class="detail"><i class="fa-regular fa-user"></i> CL-Account</span>
                    <span class="detail"><i class="fa-solid fa-lock"></i> Freischaltung nötig</span>
        </div>

        <div class="tool">
            <a class="box btn" href="/unlock"><i class="fa-solid fa-lock"></i> Freischaltung</a>
        </div>
    </article>`),
                </div>`,
                ),
                m(Service, {
                    href: "/unlock",
                    icon: "fa-solid fa-lock",
                    label: "Freischaltung",
                    sameTab: true,
                }),
            ]),
        )
    },
}
+19 −0
Changes for js/components/pieces/BoxedButton.mjs: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
export const BoxedButton = {
    view(vnode) {
        return [
            m(
                "a.box.btn",
                {
                    href: vnode.attrs.href,
                    target: vnode.attrs.sameTab ? "_blank" : "",
                },
                [
                    m("i", {
                        class: vnode.attrs.icon,
                    }),
                    vnode.attrs.label,
                ],
            ),
        ]
    },
}
+7 −0
Changes for js/components/pieces/Service.mjs: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
import { BoxedButton } from "./BoxedButton.mjs"

export const Service = {
    view(vnode) {
        return [m("div.tool", [m(BoxedButton, vnode.attrs)])]
    },
}