File tree Expand file tree Collapse file tree 3 files changed +6
-0
lines changed Expand file tree Collapse file tree 3 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ const applyTheme = (appearance: Appearance) => {
1111} ;
1212
1313const mediaQuery = window . matchMedia ( '(prefers-color-scheme: dark)' ) ;
14+
1415const handleSystemThemeChange = ( ) => {
1516 const currentAppearance = localStorage . getItem ( 'appearance' ) as Appearance ;
1617 applyTheme ( currentAppearance || 'system' ) ;
Original file line number Diff line number Diff line change 11export function useInitials ( ) {
22 const getInitials = ( fullName : string ) : string => {
33 const names = fullName . trim ( ) . split ( ' ' ) ;
4+
45 if ( names . length === 0 ) return '' ;
56 if ( names . length === 1 ) return names [ 0 ] . charAt ( 0 ) . toUpperCase ( ) ;
7+
68 return `${ names [ 0 ] . charAt ( 0 ) } ${ names [ names . length - 1 ] . charAt ( 0 ) } ` . toUpperCase ( ) ;
79 } ;
810
Original file line number Diff line number Diff line change @@ -7,11 +7,14 @@ export function useIsMobile() {
77
88 React . useEffect ( ( ) => {
99 const mql = window . matchMedia ( `(max-width: ${ MOBILE_BREAKPOINT - 1 } px)` ) ;
10+
1011 const onChange = ( ) => {
1112 setIsMobile ( window . innerWidth < MOBILE_BREAKPOINT ) ;
1213 } ;
14+
1315 mql . addEventListener ( 'change' , onChange ) ;
1416 setIsMobile ( window . innerWidth < MOBILE_BREAKPOINT ) ;
17+
1518 return ( ) => mql . removeEventListener ( 'change' , onChange ) ;
1619 } , [ ] ) ;
1720
You can’t perform that action at this time.
0 commit comments