Blame view

天文台pc/tianwentai-ui/node_modules/react-day-picker/src/hooks/useDayRender/utils/getDayStyle.ts 620 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
  import { CSSProperties } from 'react';
  
  import { DayPickerContextValue } from 'contexts/DayPicker';
  import { ActiveModifiers } from 'types/Modifiers';
  
  /** Return the style for the Day element, according to the given active modifiers. */
  export function getDayStyle(
    dayPicker: Pick<DayPickerContextValue, 'modifiersStyles' | 'styles'>,
    activeModifiers: ActiveModifiers
  ): CSSProperties {
    let style: CSSProperties = {
      ...dayPicker.styles.day
    };
    Object.keys(activeModifiers).forEach((modifier) => {
      style = {
        ...style,
        ...dayPicker.modifiersStyles?.[modifier]
      };
    });
    return style;
  }