11import * as utils from '../general' ;
22
3- type Colors = {
3+ type Values = {
44 firstColor : string ;
55 secondColor : string ;
6+ degree : string ;
67} ;
78
89/**
910 * @function gradientTextGenerator
1011 * @summary handles functionality of the gradient text generator
11- * @param attribute - The attribute name of the generator element
1212 * @return {void } Nothing
1313 */
1414export function gradientTextGenerator ( ) : void {
@@ -24,22 +24,24 @@ export function gradientTextGenerator(): void {
2424 const getTextButtonElement = utils . getResultButton ( attribute ) ;
2525 const getFirstColor = utils . getColorInput1 ( attribute ) ;
2626 const getSecondColor = utils . getColorInput2 ( attribute ) ;
27+ const getRangeElement = utils . getRange ( attribute ) ;
2728
2829 getTextButtonElement ?. addEventListener ( 'click' , ( ) => {
2930 if ( getInputElement . value . length === 0 ) return ;
3031
31- const colors = {
32+ const values = {
3233 firstColor : getFirstColor . value ,
3334 secondColor : getSecondColor . value ,
35+ degree : getRangeElement . value ,
3436 } ;
3537
3638 getGradientTextResult (
3739 attribute ,
3840 getInputElement . value ,
39- colors ,
41+ values ,
4042 getOutputElement ,
4143 ) ;
42- getInputElement . value = '' ;
44+ // getInputElement.value = '';
4345 } ) ;
4446}
4547
@@ -53,14 +55,14 @@ export function gradientTextGenerator(): void {
5355function getGradientTextResult (
5456 attribute : string ,
5557 text : string ,
56- colors : Colors ,
58+ values : Values ,
5759 outputElement : HTMLElement ,
5860) : void {
5961 const createTextElement = ( ) => {
6062 const wordElement = document . createElement ( 'p' ) ;
6163 wordElement . innerText = text ;
6264 wordElement . style . fontSize = '2rem' ;
63- wordElement . style . background = `linear-gradient(to bottom , ${ colors . firstColor } 50% , ${ colors . secondColor } )` ;
65+ wordElement . style . background = `linear-gradient(${ values . degree } deg , ${ values . firstColor } , ${ values . secondColor } )` ;
6466 wordElement . style . webkitBackgroundClip = 'text' ;
6567 wordElement . style . backgroundClip = 'text' ;
6668 wordElement . style . webkitTextFillColor = 'transparent' ;
0 commit comments