File tree Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Expand file tree Collapse file tree 2 files changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,8 @@ const PatronContainer = styled.div`
6868 }
6969
7070 @media only screen and (max-width: 809px) {
71+ width: 75%;
72+
7173 p {
7274 font-size: 0.8rem;
7375 font-weight: bold;
Original file line number Diff line number Diff line change @@ -150,3 +150,17 @@ export function elapsedBefore(
150150 throw new Error ( type ) ;
151151 }
152152}
153+
154+ export function sortByKey < T extends Record < string , any > > ( array : T [ ] , key : keyof T ) : T [ ] {
155+ return array . sort ( ( a , b ) => {
156+ const av = a [ key ] as any ;
157+ const bv = b [ key ] as any ;
158+
159+ if ( av == null ) return - 1 ;
160+ if ( bv == null ) return 1 ;
161+ if ( typeof av === "number" && typeof bv === "number" ) return av - bv ;
162+ if ( av instanceof Date && bv instanceof Date ) return av . getTime ( ) - bv . getTime ( ) ;
163+
164+ return av === bv ? 0 : av > bv ? 1 : - 1 ;
165+ } ) ;
166+ }
You can’t perform that action at this time.
0 commit comments