Mudanças entre as edições de "Módulo:Gb"

De Wiki Gla
Ir para navegação Ir para pesquisar
Linha 10: Linha 10:
     local link  = args.link or "#"
     local link  = args.link or "#"


    -- Cria container
     local html = mw.html.create("div")
     local html = mw.html.create("div")
         :css("position", "relative")
         :css("position", "relative")
Linha 21: Linha 22:
         :css("background", imagem ~= "" and "url(" .. mw.uri.encode(mw.title.makeTitle('File', imagem).fullUrl) .. ") center/cover no-repeat #111" or "#111")
         :css("background", imagem ~= "" and "url(" .. mw.uri.encode(mw.title.makeTitle('File', imagem).fullUrl) .. ") center/cover no-repeat #111" or "#111")


     html:tag("div")
     -- Título
        :css("position", "absolute")
        :css("inset", "0")
        :css("background", "linear-gradient(180deg,rgba(0,0,0,0.05)0%,rgba(0,0,0,0.6)55%,rgba(0,0,0,0.85)100%)")
 
     html:tag("div")
     html:tag("div")
         :css("position", "absolute")
         :css("position", "absolute")
Linha 31: Linha 28:
         :css("right", "12px")
         :css("right", "12px")
         :css("bottom", "70px")
         :css("bottom", "70px")
        :tag("div")
         :css("font-size", "16px")
         :css("font-size", "16px")
         :css("font-weight", "800")
         :css("font-weight", "800")
         :wikitext(titulo)
         :wikitext(titulo)


    -- Botão
     html:tag("a")
     html:tag("a")
         :attr("href", link)
         :attr("href", link)

Edição das 04h18min de 27 de agosto de 2025

A documentação para este módulo pode ser criada em Módulo:Gb/doc

local p = {}

function p.render(frame)
    local parent = frame:getParent()
    local args = parent and parent.args or frame.args

    local imagem = args.imagem or ""
    local titulo = args.titulo or "Título"
    local botao  = args.botao or "Ler agora"
    local link   = args.link or "#"

    -- Cria container
    local html = mw.html.create("div")
        :css("position", "relative")
        :css("width", "216px")
        :css("height", "292px")
        :css("border-radius", "14px")
        :css("overflow", "hidden")
        :css("font-family", "Inter,Segoe UI,Roboto,Arial,sans-serif")
        :css("color", "#fff")
        :css("box-shadow", "0 6px 18px rgba(0,0,0,.35)")
        :css("background", imagem ~= "" and "url(" .. mw.uri.encode(mw.title.makeTitle('File', imagem).fullUrl) .. ") center/cover no-repeat #111" or "#111")

    -- Título
    html:tag("div")
        :css("position", "absolute")
        :css("left", "12px")
        :css("right", "12px")
        :css("bottom", "70px")
        :css("font-size", "16px")
        :css("font-weight", "800")
        :wikitext(titulo)

    -- Botão
    html:tag("a")
        :attr("href", link)
        :css("position", "absolute")
        :css("left", "12px")
        :css("right", "12px")
        :css("bottom", "14px")
        :css("display", "block")
        :css("text-align", "center")
        :css("padding", "10px 12px")
        :css("background", "#1f8b4c")
        :css("color", "#eafff3")
        :css("font-weight", "800")
        :css("font-size", "14px")
        :css("text-decoration", "none")
        :css("border-radius", "10px")
        :node(mw.html.create("span"):wikitext(botao))

    return tostring(html)
end

return p