import dash 
from dash.dependencies import Output
from dash.dependencies import Input

@dash.callback(
             Output('caret1', 'style'),
             [Input('collapse-1', 'is_open')],
)
def rotate_section_1_caret(collapse_open):
    """ Rotates section 1 menu caret """
    rotate_caret = {
      'top':'.05rem',
      'transform': 'rotate(180deg)',
      '-ms-transform': 'rotate(180deg)',
      '-webkit-transform': 'rotate(180deg)'
    }
    if not collapse_open:
        return rotate_caret

@dash.callback(
             Output('caret2', 'style'),
             [Input('collapse-2', 'is_open')],
)
def rotate_section_2_caret(collapse_open):
    """ Rotates section 2 menu caret """
    rotate_caret = {
      'transform': 'rotate(0deg)',
      '-ms-transform': 'rotate(0deg)',
      '-webkit-transform': 'rotate(0deg)'
    }
    if collapse_open:
        return rotate_caret

@dash.callback(
             Output('caret3', 'style'),
             [Input('collapse-3', 'is_open')],
)
def rotate_section_3_caret(collapse_open):
    """ Rotates section 3 menu caret """
    rotate_caret = {
      'transform': 'rotate(0deg)',
      '-ms-transform': 'rotate(0deg)',
      '-webkit-transform': 'rotate(0deg)'
    }
    if collapse_open:
        return rotate_caret
