Server IP : 80.87.202.40 / Your IP : 216.73.216.169 Web Server : Apache System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64 User : bitrix ( 600) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /home/bitrix/ext_www/rospirotorg.ru/bitrix/js/landing/ui/field/color/src/processor/ |
Upload File : |
import Color from "./color"; import ColorValue from '../color_value'; export default class ButtonColor extends Color { static COLOR_CONTRAST_VAR: string = '--button-color-contrast'; static COLOR_HOVER_VAR: string = '--button-color-hover'; static COLOR_LIGHT_VAR: string = '--button-color-light'; static COLOR_VAR: string = '--button-color'; constructor(options) { super(options); this.setEventNamespace('BX.Landing.UI.Field.Processor.ButtonColor'); this.property = 'background-color'; // order is important! Base variable must be last. Hack :-/ this.variableName = [ ButtonColor.COLOR_CONTRAST_VAR, ButtonColor.COLOR_HOVER_VAR, ButtonColor.COLOR_LIGHT_VAR, ButtonColor.COLOR_VAR, ]; this.className = 'g-button-color'; //todo: ? } getStyle(): {string: ?string} { if (this.getValue() === null) { return { [ButtonColor.COLOR_CONTRAST_VAR]: null, [ButtonColor.COLOR_HOVER_VAR]: null, [ButtonColor.COLOR_LIGHT_VAR]: null, [ButtonColor.COLOR_VAR]: null, }; } const value = this.getValue(); const valueContrast = value.getContrast().lighten(10); const valueHover = new ColorValue(value).lighten(10); const valueLight = value.getLighten(); return { [ButtonColor.COLOR_CONTRAST_VAR]: valueContrast.getStyleString(), [ButtonColor.COLOR_HOVER_VAR]: valueHover.getStyleString(), [ButtonColor.COLOR_LIGHT_VAR]: valueLight.getStyleString(), [ButtonColor.COLOR_VAR]: value.getStyleString(), }; } }