-
Notifications
You must be signed in to change notification settings - Fork 21
Expand file tree
/
Copy pathTextPlaceholder.tsx
More file actions
51 lines (47 loc) · 2.08 KB
/
Copy pathTextPlaceholder.tsx
File metadata and controls
51 lines (47 loc) · 2.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { BodyText } from 'components/common/Typography';
import React from 'react';
interface TextPlaceholderProps {
type?: 'short' | 'paragraph' | 'long';
text?: string;
}
/**
* Text placeholder for missing content in preview mode.
* Shows example text or lorem ipsum depending on the text type.
* Returns just the text content so parent typography components can apply their own styling.
*/
export const TextPlaceholder: React.FC<TextPlaceholderProps> = ({ type = 'paragraph', text }) => {
const getPlaceholderText = () => {
if (text) return text;
switch (type) {
case 'short':
return 'Lorem ipsum dolor sit amet.';
case 'paragraph':
return 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris.';
case 'long':
return 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
default:
return 'Example text';
}
};
return (
<BodyText
component="span"
color="currentColor"
fontSize="inherit"
fontStyle="inherit"
fontWeight="inherit"
lineHeight="inherit"
sx={{
textDecoration: 'underline',
textDecorationStyle: 'wavy',
textDecorationColor: 'color-mix(in srgb, currentColor, transparent 70%)',
'&:hover': {
opacity: 0.5,
},
}}
>
{getPlaceholderText()}
</BodyText>
);
};
export default TextPlaceholder;