portfolio / portfolio-webapp / webapp / frontend / public.mjs
public.mjs
Raw
import './scss/public/main.scss';
import './js/base.mjs';
import * as utils from './js/utils.mjs';

window.utils = utils;

$('body').on('click', '.resume-card-select', function() {
    const $btn = $(this);
    const $card = $btn.closest('.card');
    if ($card.hasClass('selected')) {
        $card.removeClass('selected');
        $('.resume-skill-badge').each(function() {
            $(this).removeClass('not-selected');
        });
    } else {
        const $parent = $card.closest('.resume-card-group');
        $('.card', $parent).each(function() {
            if ($(this).attr('id') != $card.attr('id')) {
                $(this).removeClass('selected');
                $('.collapse', $(this)).collapse('hide');
            }
        });
        $card.addClass('selected');
        const skillList = $btn.data('skills');
        let skills = skillList.split(',');
        $('.resume-skill-badge').each(function() {
            const $badge = $(this);
            if (skills.includes(`${$badge.data('skill-id')}`)) {
                $badge.removeClass('not-selected');
            } else {
                $badge.addClass('not-selected');
            }
        });
    }
});