JSFiddle - React, Tailwind, and code Playground

HTML

<!-- 
Custom YouTube Style "Sparkbar"
Written by Martyr2
Founder of The Coders Lexicon
Check out our programmers idea book http://www.coderslexicon.com/downloads/the-programmers-idea-book/
-->

<div id="sparkbar">
    <div class="sparkbar-like"></div>
    <div class="sparkbar-dislike"></div>
</div>

<!-- Value could come from server-side (like PHP) or JavaScript. -->
<div id="sparkbar-update" style="clear: left;">
    Enter between 0 - 100: <input type="text" name="percentage" id="percentage" style="clear: left;"/><input type="button" id="update-button" value="Update"/>
</div>

CSS

#sparkbar {
    margin: 50px 0px;
    width: 150px;
    float: left;
    height: 2px;
    overflow: hidden;
}

div .sparkbar-like, div .sparkbar-dislike {
    float: left;
    height: 4px;
}

div .sparkbar-like {
    background-color: #590;
}

div .sparkbar-dislike {
    background-color: #ccc;
}

JavaScript

$(function() {
    
    $("#update-button").click(function() {
        var percent = parseInt($("#percentage").val());

        if ((percent >= 0) && (percent <= 100)) {
            var sparkbar = $("#sparkbar").width();

            if (sparkbar >= 0) {
                // Based on 100 percentage and width of sparkbar
                var like_percentage = percent;
                var dislike_percentage = 100 - like_percentage;
                $(".sparkbar-like").css("width", like_percentage + "%");   
                $(".sparkbar-dislike").css("width", dislike_percentage + "%");
            }
        }
    });

});