-
Notifications
You must be signed in to change notification settings - Fork 17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add InfoCard and Stud components for landing pages #1737
Changes from 3 commits
537b382
bc848b4
ef0ddac
a2d1736
44302aa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@theguild/components': minor | ||
--- | ||
|
||
Add InfoCard and Stud components for landing pages' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { hiveThemeDecorator } from '../../../../.storybook/hive-theme-decorator'; | ||
import { AccountBox } from './icons'; | ||
import { InfoCard, InfoCardProps } from './info-card'; | ||
|
||
export default { | ||
title: 'Components/InfoCard', | ||
component: InfoCard, | ||
decorators: [hiveThemeDecorator], | ||
} satisfies Meta<InfoCardProps>; | ||
|
||
export const Default: StoryObj<InfoCardProps> = { | ||
args: { | ||
icon: <AccountBox />, | ||
as: 'div', | ||
heading: 'Customizable User Roles and Permissions', | ||
children: | ||
'Control user access with detailed, role-based permissions for enhanced security and flexibility.', | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -0,0 +1,26 @@ | ||||||
import { ReactNode } from 'react'; | ||||||
import { cn } from '../cn'; | ||||||
import { Stud } from './stud'; | ||||||
|
||||||
export interface InfoCardProps extends React.HTMLAttributes<HTMLElement> { | ||||||
icon: ReactNode; | ||||||
heading: ReactNode; | ||||||
as?: 'div' | 'li'; | ||||||
} | ||||||
|
||||||
export function InfoCard({ | ||||||
as: Root = 'div', | ||||||
icon, | ||||||
heading, | ||||||
className, | ||||||
children, | ||||||
...rest | ||||||
}: InfoCardProps) { | ||||||
return ( | ||||||
<Root className={cn('bg-beige-100 p-6 md:p-12', className)} {...rest}> | ||||||
<Stud>{icon}</Stud> | ||||||
<h3 className="mt-4 text-xl font-medium leading-[1.4] text-green-1000 md:mt-6">{heading}</h3> | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
what's 1.4 stay for I guess it's 18px? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh thx, and yes you right, you can remove it, also for the future there is shorthand |
||||||
<p className="mt-2 text-green-800 md:mt-4">{children}</p> | ||||||
</Root> | ||||||
); | ||||||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { Meta, StoryObj } from '@storybook/react'; | ||
import { hiveThemeDecorator } from '../../../../.storybook/hive-theme-decorator'; | ||
import { RightCornerIcon } from './icons'; | ||
import { Stud, StudProps } from './stud'; | ||
|
||
export default { | ||
title: 'Components/Stud', | ||
component: Stud, | ||
decorators: [hiveThemeDecorator], | ||
} satisfies Meta<StudProps>; | ||
|
||
export const Default: StoryObj<StudProps> = { | ||
name: 'Stud', | ||
args: { | ||
children: <RightCornerIcon />, | ||
}, | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { cn } from '../cn'; | ||
|
||
export interface StudProps extends React.HTMLAttributes<HTMLElement> {} | ||
export function Stud(props: StudProps) { | ||
return ( | ||
<div | ||
{...props} | ||
className={cn( | ||
'w-fit rounded-lg bg-[linear-gradient(135deg,#68A8B6,#3B736A)] p-[9px] text-white', | ||
props.className, | ||
)} | ||
/> | ||
); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
like in Stud
to not have a list? or do you plan to add more stories here?