Skip to content

Commit

Permalink
fix: text example and component
Browse files Browse the repository at this point in the history
  • Loading branch information
Viraj-10 committed Jul 16, 2024
1 parent f4dd212 commit 590c15e
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 40 deletions.
39 changes: 23 additions & 16 deletions example/storybook-nativewind/src/components/Text/Text.stories.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,30 +27,37 @@ const TextMeta: ComponentMeta<typeof Text> = {
'6xl',
],
},
fontWeight: {
control: 'select',
options: [
'hairline',
'thin',
'light',
'normal',
'medium',
'semibold',
'bold',
'extrabold',
'black',
'extrablack',
],
bold: {
control: 'boolean',
},
italic: {
control: 'boolean',
},
underline: {
control: 'boolean',
},
strikeThrough: {
control: 'boolean',
},
highlight: {
control: 'boolean',
},
sub: {
control: 'boolean',
},
},
args: {
text: 'Hello world',
size: 'md',
fontWeight: 'medium',
bold: false,
italic: false,
underline: false,
strikeThrough: false,
highlight: false,
sub: false,
},
};

export default TextMeta;

export { Text };
// export { TextSizes };
26 changes: 2 additions & 24 deletions example/storybook-nativewind/src/components/Text/Text.tsx
Original file line number Diff line number Diff line change
@@ -1,31 +1,9 @@
import React from 'react';
import { Text } from '@/components/ui/text';

const TextBasic = ({
size = 'md',
text = 'Hello world',
fontWeight = 'bold',
...props
}: any) => {
const fontWeights = {
hairline: 'font-hairline',
thin: 'font-thin',
light: 'font-light',
normal: 'font-normal',
medium: 'font-medium',
semibold: 'font-semibold',
bold: 'font-bold',
extrabold: 'font-extrabold',
black: 'font-black',
extrablack: 'font-extrablack',
};

const TextBasic = ({ size = 'md', text = 'Hello world', ...props }: any) => {
return (
<Text
size={size}
{...props}
className={`${fontWeights[fontWeight as keyof typeof fontWeights]}`}
>
<Text size={size} {...props}>
{text}
</Text>
);
Expand Down

0 comments on commit 590c15e

Please sign in to comment.