Closed RobbertWolfs closed 1 month ago
Note with 100+ chars -> we slice the content with ... dots
Note with less than 100 chars -> we show "No content" even when we have content
After the change
Thanks for this! I'll want to have this change happen for all following exercises so we don't end up with a diff that incorrectly "reverts" this change in the next exercise here :)
I'll update it in the next exercises as well
@kentcdodds Fixed it on the next exercises as well.
Is it useful to create a util function for this or is this overkill for the exercise?
function generateNoteSummary({
content,
maxLength = 100,
sliceLength = 97
}: NoteSummaryParams): string {
if (!content) {
return 'No content';
}
if (content.length > maxLength) {
return content.slice(0, sliceLength) + '...';
}
return content;
}
@kentcdodds I also noticed that in the following workshops we also have the same "code" so is it necessary to also fix it there or ?
When the note content is below 100 chars we currently show 'No content' instead of the content itself