1- import { useContext , useMemo } from 'react' ;
2- import { StyleSheet , View } from 'react-native' ;
1+ import { useMemo } from 'react' ;
2+ import { View } from 'react-native' ;
33
4- import { A , Caption , colors , darkColors , H6 , useLayout } from '~/common/styleguide' ;
4+ import { A , Caption , H6 , useLayout } from '~/common/styleguide' ;
55import ContentContainer from '~/components/ContentContainer' ;
66import { DirectoryScore } from '~/components/Library/DirectoryScore' ;
77import DetailsNavigation from '~/components/Package/DetailsNavigation' ;
88import NotFound from '~/components/Package/NotFound' ;
99import PackageHeader from '~/components/Package/PackageHeader' ;
1010import PageMeta from '~/components/PageMeta' ;
1111import { ScoringCriterion } from '~/components/Score/ScoringCriterion' ;
12- import CustomAppearanceContext from '~/context/CustomAppearanceContext' ;
1312import { type PackageScorePageProps } from '~/types/pages' ;
1413import { SCORING_CRITERIONS } from '~/util/scoring' ;
1514import tw from '~/util/tailwind' ;
1615
1716export default function PackageScoreScene ( { apiData, packageName } : PackageScorePageProps ) {
18- const { isDark } = useContext ( CustomAppearanceContext ) ;
1917 const { isSmallScreen } = useLayout ( ) ;
2018
2119 const library = useMemo (
@@ -27,14 +25,6 @@ export default function PackageScoreScene({ apiData, packageName }: PackageScore
2725 return < NotFound /> ;
2826 }
2927
30- const scoreBoxBorderColor = isDark ? darkColors . border : colors . gray3 ;
31- const headerColorStyle = {
32- color : isDark ? darkColors . secondary : colors . gray5 ,
33- } ;
34- const secondaryColorStyle = {
35- color : isDark ? colors . gray4 : colors . gray5 ,
36- } ;
37-
3828 return (
3929 < >
4030 < PageMeta
@@ -48,45 +38,36 @@ export default function PackageScoreScene({ apiData, packageName }: PackageScore
4838 < PackageHeader library = { library } />
4939 < View
5040 style = { [
51- styles . scoreBox ,
52- isSmallScreen && styles . scoreBoxSmall ,
53- {
54- borderColor : scoreBoxBorderColor ,
55- backgroundColor : isDark ? colors . gray7 : colors . gray1 ,
56- } ,
41+ tw `items-center flex-row gap-1 mt-2 mb-3 py-4 px-7 border rounded-xl border-palette-gray3 bg-palette-gray1 dark:bg-palette-gray7 dark:border-default` ,
42+ isSmallScreen && tw `flex-col px-5` ,
5743 ] } >
5844 < View style = { tw `items-center` } >
59- < H6 style = { styles . sectionHeader } > Directory score</ H6 >
45+ < H6 style = { tw `mb-3` } > Directory score</ H6 >
6046 < DirectoryScore score = { library . score } sizeMultiplier = { 2 } />
61- < span
62- style = { {
63- ...styles . scoreIndicator ,
64- color : isDark ? darkColors . primaryDark : colors . primaryDark ,
65- } } >
47+ < span style = { tw `flex text-[24px] font-semibold items-center mt-1 text-primary-dark` } >
6648 { library . score } /100
6749 </ span >
6850 </ View >
6951 < View
7052 style = { [
71- styles . separator ,
72- isSmallScreen && styles . separatorSmall ,
73- { backgroundColor : scoreBoxBorderColor } ,
53+ tw `w-[0.5px] min-h-[112px] mx-7 bg-palette-gray3 dark:bg-dark-brighter` ,
54+ isSmallScreen && tw `w-full min-h-[0.5px] mx-0 my-3` ,
7455 ] }
7556 />
7657 < View style = { tw `flex flex-shrink gap-2` } >
77- < Caption style = { [ tw `font-light` , secondaryColorStyle ] } >
58+ < Caption style = { tw `font-light text-palette-gray5 dark:text-palette-gray4` } >
7859 The Directory Score is the combination of multiple factors that relate to the
7960 quality of a library. A library can earn value by exhibiting "good behavior
8061 criteria" and can lose value by exhibiting "bad behavior criteria".
8162 </ Caption >
82- < Caption style = { [ tw `font-light` , secondaryColorStyle ] } >
63+ < Caption style = { tw `font-light text-palette-gray5 dark:text-palette-gray4` } >
8364 Scores are subjective and are based on data that's readily available on GitHub and
8465 npm. They are not a perfect scores and may not reflect quality for your specific
8566 needs. < A href = "/scoring" > Read more</ A > .
8667 </ Caption >
8768 </ View >
8869 </ View >
89- < H6 style = { headerColorStyle } > Matching criteria</ H6 >
70+ < H6 style = { tw `text-palette-gray5 dark:text-secondary` } > Matching criteria</ H6 >
9071 < View >
9172 { SCORING_CRITERIONS . filter ( ( { name } ) =>
9273 library . matchingScoreModifiers . includes ( name )
@@ -96,7 +77,7 @@ export default function PackageScoreScene({ apiData, packageName }: PackageScore
9677 </ ScoringCriterion >
9778 ) ) }
9879 </ View >
99- < H6 style = { headerColorStyle } > Not matched criteria</ H6 >
80+ < H6 style = { tw `text-palette-gray5 dark:text-secondary` } > Not matched criteria</ H6 >
10081 < View >
10182 { SCORING_CRITERIONS . filter (
10283 ( { name } ) => ! library . matchingScoreModifiers . includes ( name )
@@ -105,7 +86,8 @@ export default function PackageScoreScene({ apiData, packageName }: PackageScore
10586 headline = { name }
10687 score = { value }
10788 key = { `unmatch-${ name } ` }
108- style = { styles . unmatchedCriterion } >
89+ // TODO: add PR with RN filters
90+ style = { tw `opacity-60 border-2 border-dashed grayscale` } >
10991 { description }
11092 </ ScoringCriterion >
11193 ) ) }
@@ -115,50 +97,3 @@ export default function PackageScoreScene({ apiData, packageName }: PackageScore
11597 </ >
11698 ) ;
11799}
118-
119- const styles = StyleSheet . create ( {
120- scoreBox : {
121- display : 'flex' ,
122- alignItems : 'center' ,
123- flexDirection : 'row' ,
124- gap : 4 ,
125- marginTop : 8 ,
126- marginBottom : 12 ,
127- paddingVertical : 16 ,
128- paddingHorizontal : 28 ,
129- borderWidth : 1 ,
130- borderStyle : 'solid' ,
131- borderRadius : 12 ,
132- } ,
133- scoreBoxSmall : {
134- flexDirection : 'column' ,
135- paddingHorizontal : 20 ,
136- } ,
137- sectionHeader : {
138- marginBottom : 12 ,
139- } ,
140- scoreIndicator : {
141- display : 'flex' ,
142- fontSize : 24 ,
143- fontWeight : 600 ,
144- alignItems : 'center' ,
145- marginTop : 4 ,
146- } ,
147- separator : {
148- width : 0.5 ,
149- minHeight : 112 ,
150- marginHorizontal : 28 ,
151- } ,
152- separatorSmall : {
153- width : '100%' ,
154- minHeight : 0.5 ,
155- marginHorizontal : 0 ,
156- marginVertical : 12 ,
157- } ,
158- unmatchedCriterion : {
159- filter : 'grayscale(1)' ,
160- opacity : 0.6 ,
161- borderStyle : 'dashed' ,
162- borderWidth : 2 ,
163- } ,
164- } ) ;
0 commit comments