Grade
The Grade component displays grade information in a clean, pressable card format.
Import
import { Grade } from 'papillon-ui';
Basic Usage
<Grade
title="Mathematics Test"
date={Date.now()}
score={16.5}
outOf={20}
color="#4A90E2"
onPress={() => {}}
/>
Props
Grade title or description
Date timestamp (milliseconds)
Disabled state (shows status instead of score)
Status text (shown when disabled)
Positioning
Adds rounded corners at the top
Adds rounded corners at the bottom and bottom margin
Examples
Standard Grade
<Grade
title="Physics Quiz"
date={Date.now()}
score={18}
outOf={20}
color="#10B981"
onPress={() => showDetails()}
/>
Disabled Grade
<Grade
title="Upcoming Test"
date={Date.now()}
score={0}
outOf={20}
disabled
status="Non noté"
color="#6B7280"
/>
Grade List
function GradeList({ grades }) {
return (
<View>
{grades.map((grade, index) => (
<Grade
key={grade.id}
isFirst={index === 0}
isLast={index === grades.length - 1}
title={grade.title}
date={grade.date}
score={grade.score}
outOf={grade.outOf}
color={grade.color}
onPress={() => navigate('GradeDetail', { id: grade.id })}
/>
))}
</View>
);
}
Skeleton Loading
<Grade
title=""
date={Date.now()}
score={0}
outOf={20}
skeleton
/>