This commit is contained in:
@@ -10,11 +10,26 @@ type PageHeroProps = {
|
||||
};
|
||||
|
||||
function getDefaultLines(title: string): HeroTitleLineValue[] {
|
||||
return title.split("\n").filter(Boolean).map((line, index) => ({
|
||||
text: line,
|
||||
tone: index === 0 ? "soft" : "accent",
|
||||
align: "center",
|
||||
}));
|
||||
return title.split("\n").filter(Boolean).map((line) => {
|
||||
const words = line.trim().split(/\s+/).filter(Boolean);
|
||||
|
||||
if (words.length <= 1) {
|
||||
return {
|
||||
text: line,
|
||||
tone: "soft",
|
||||
align: "center",
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
text: line,
|
||||
align: "center",
|
||||
segments: words.map((word, index) => ({
|
||||
text: index === words.length - 1 ? word : `${word} `,
|
||||
tone: index % 2 === 0 ? "soft" : "accent",
|
||||
})),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
export function PageHero({ badge, title, description, lines, locale }: PageHeroProps) {
|
||||
|
||||
Reference in New Issue
Block a user