Basculer le menu
Changer de menu des préférences
Basculer le menu personnel
Non connecté(e)
Votre adresse IP sera visible au public si vous faites des modifications.

La documentation pour ce module peut être créée à Module:NavCard/doc

local p = {}

function p.main(frame)
    local args = frame:getParent().args
    
    -- Récupération des paramètres
    local titre = args['titre'] or args[1] or 'Titre'
    local description = args['description'] or args[2] or 'Description'
    local lien = args['lien'] or args[3] or titre
    local image = args['image'] or args[4] or ''
    local couleur = args['couleur'] or '#3b82f6'
    
    -- Création du lien cliquable
    local lienUrl = mw.uri.encode(lien, 'WIKI')
    
    -- Construction de l'HTML avec un vrai lien
    local html = mw.html.create('a')
        :attr('href', mw.title.new(lien):fullUrl())
        :addClass('wiki-nav-card-link')
        :css({
            ['display'] = 'block',
            ['text-decoration'] = 'none',
            ['color'] = 'inherit'
        })
    
    local card = html:tag('div')
        :addClass('wiki-nav-card')
        :css({
            ['background'] = 'linear-gradient(135deg, ' .. couleur .. ' 0%, rgba(59, 130, 246, 0.8) 100%)',
            ['border-radius'] = '16px',
            ['padding'] = '24px',
            ['margin'] = '8px',
            ['max-width'] = '320px',
            ['min-height'] = '200px',
            ['position'] = 'relative',
            ['overflow'] = 'hidden',
            ['box-shadow'] = '0 4px 12px rgba(0, 0, 0, 0.2)',
            ['transition'] = 'all 0.3s ease',
            ['cursor'] = 'pointer',
            ['color'] = 'white'
        })
    
    -- Image en haut
    if image and image ~= '' then
        local imageHtml = '[[File:' .. image .. '|80px|link=]]'
        card:tag('div')
            :css({
                ['text-align'] = 'center',
                ['margin-bottom'] = '16px'
            })
            :wikitext(imageHtml)
    else
        card:tag('div')
            :css({
                ['text-align'] = 'center',
                ['font-size'] = '48px',
                ['margin-bottom'] = '16px',
                ['opacity'] = '0.7'
            })
            :wikitext('📄')
    end
    
    -- Titre
    card:tag('h3')
        :css({
            ['margin'] = '0 0 12px 0',
            ['color'] = 'white',
            ['font-size'] = '1.4rem',
            ['font-weight'] = 'bold',
            ['text-align'] = 'center'
        })
        :wikitext(titre)
    
    -- Description
    card:tag('p')
        :css({
            ['margin'] = '0',
            ['color'] = 'rgba(255, 255, 255, 0.9)',
            ['font-size'] = '0.9rem',
            ['line-height'] = '1.4',
            ['text-align'] = 'center'
        })
        :wikitext(description)
    
    return tostring(html)
end

return p