-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: update base Button [MDS-718] (#2440)
- Loading branch information
Showing
26 changed files
with
289 additions
and
86 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
Buttons allow users to take actions, and make choices, with a single tap. | ||
|
||
Buttons communicate actions that users can take. They are typically placed throughout your UI, in places like: | ||
|
||
Modal windows | ||
Forms | ||
Cards | ||
Toolbars |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import Button from '@heathmont/moon-base-tw/lib/button/Button'; | ||
|
||
export const Animations = () => ( | ||
<> | ||
<Button animation="progress" variant="outline"> | ||
Progress | ||
</Button> | ||
<Button animation="success" variant="outline"> | ||
Success | ||
</Button> | ||
<Button animation="error" variant="outline"> | ||
Error | ||
</Button> | ||
<Button animation="pulse" variant="outline"> | ||
Pulse | ||
</Button> | ||
</> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Button from '@heathmont/moon-base-tw/lib/button/Button'; | ||
|
||
export const Default = () => <Button>Default</Button>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
import Button from '@heathmont/moon-base-tw/lib/button/Button'; | ||
|
||
export const Disabled = () => <Button disabled>Disabled</Button>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import Button from '@heathmont/moon-base-tw/lib/button/Button'; | ||
import { OtherFrame } from '@heathmont/moon-icons-tw'; | ||
|
||
export const FullWidth = () => ( | ||
<Button iconRight={<OtherFrame />} fullWidth> | ||
Full width | ||
</Button> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Button from '@heathmont/moon-base-tw/lib/button/Button'; | ||
import { OtherFrame } from '@heathmont/moon-icons-tw'; | ||
|
||
export const Icons = () => ( | ||
<> | ||
<Button iconLeft={<OtherFrame />}>IconLeft</Button> | ||
<Button iconRight={<OtherFrame />}>IconRight</Button> | ||
</> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import Button from '@heathmont/moon-base-tw/lib/button/Button'; | ||
|
||
export const Multiline = () => ( | ||
<Button size="xl" className="py-3"> | ||
<span className="flex flex-col gap-1"> | ||
<span className="leading-none">Button text</span> | ||
<span className="text-moon-9 font-normal leading-[12px]"> | ||
Placeholder text | ||
</span> | ||
</span> | ||
</Button> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import Button from '@heathmont/moon-base-tw/lib/button/Button'; | ||
|
||
export const Sizes = () => ( | ||
<> | ||
<Button size="xs">Size XS</Button> | ||
<Button size="sm">Size SM</Button> | ||
<Button>Default size MD</Button> | ||
<Button size="lg">Size LG</Button> | ||
<Button size="xl">Size XL</Button> | ||
</> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import Button from '@heathmont/moon-base-tw/lib/button/Button'; | ||
|
||
export const Variants = () => ( | ||
<> | ||
<Button>Default is Fill</Button> | ||
<Button variant="outline">Outline</Button> | ||
<Button variant="ghost">Ghost</Button> | ||
</> | ||
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { Animations } from '@/app/components/server/button/examples/Animations'; | ||
import { Default } from '@/app/components/server/button/examples/Default'; | ||
import { Disabled } from '@/app/components/server/button/examples/Disabled'; | ||
import { FullWidth } from '@/app/components/server/button/examples/FullWidth'; | ||
import { Icons } from '@/app/components/server/button/examples/Icons'; | ||
import { Multiline } from '@/app/components/server/button/examples/Multiline'; | ||
import { Sizes } from '@/app/components/server/button/examples/Sizes'; | ||
import { Variants } from '@/app/components/server/button/examples/Variants'; | ||
import ExampleSection from '@/app/components/shared/ExampleSection'; | ||
import QuickNav from '@/app/components/shared/QuickNav'; | ||
import { getExamples } from '@/app/utils/getExamples'; | ||
import { MDX } from '@/components/MDX'; | ||
|
||
export default async function Home() { | ||
const { server } = await getExamples(); | ||
const examplesList = Object.keys(server.button.examples); | ||
return ( | ||
<div className="w-full max-w-7xl flex flex-col gap-4 text-moon-14"> | ||
<h1 className="font-medium text-moon-32">Button</h1> | ||
<MDX markdown={server.button.description} /> | ||
<QuickNav items={examplesList} /> | ||
<ExampleSection | ||
title="Default" | ||
component={<Default />} | ||
code={server.button.examples.Default} | ||
/> | ||
<ExampleSection | ||
title="Sizes" | ||
component={<Sizes />} | ||
code={server.button.examples.Sizes} | ||
/> | ||
<ExampleSection | ||
title="Variants" | ||
component={<Variants />} | ||
code={server.button.examples.Variants} | ||
/> | ||
<ExampleSection | ||
title="Icons" | ||
component={<Icons />} | ||
code={server.button.examples.Icons} | ||
/> | ||
<ExampleSection | ||
title="FullWidth" | ||
component={<FullWidth />} | ||
code={server.button.examples.FullWidth} | ||
/> | ||
<ExampleSection | ||
title="Disabled" | ||
component={<Disabled />} | ||
code={server.button.examples.Disabled} | ||
/> | ||
<ExampleSection | ||
title="Animations" | ||
component={<Animations />} | ||
code={server.button.examples.Animations} | ||
/> | ||
<ExampleSection | ||
title="Multiline" | ||
component={<Multiline />} | ||
code={server.button.examples.Multiline} | ||
/> | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const QuickNav = ({ items }: { items: string[] }) => ( | ||
<ul> | ||
{items.map((item) => ( | ||
<li key={item}> | ||
<a href={`#${item}`}>{item}</a> | ||
</li> | ||
))} | ||
</ul> | ||
); | ||
|
||
export default QuickNav; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,46 +1,59 @@ | ||
export interface Examples { | ||
"client": { | ||
"accordion": { | ||
"description": "string", | ||
"examples": { | ||
"Default": "string" | ||
} | ||
}, | ||
"button": { | ||
"description": "string", | ||
"examples": { | ||
"Default": "string" | ||
} | ||
} | ||
}, | ||
"server": { | ||
"accordion": { | ||
"description": "string", | ||
"examples": { | ||
"ContentOutsideSizes": "string", | ||
"Default": "string", | ||
"Disabled": "string", | ||
"Sizes": "string" | ||
} | ||
}, | ||
"avatar": { | ||
"description": "string", | ||
"examples": { | ||
"Active": "string", | ||
"Default": "string" | ||
} | ||
}, | ||
"tag": { | ||
"description": "string", | ||
"examples": { | ||
"Default": "string" | ||
} | ||
} | ||
}, | ||
"shared": { | ||
"fonts": { | ||
"DMSans-Regular": "string", | ||
"DMSans-Semibold": "string" | ||
} | ||
} | ||
}; | ||
client: { | ||
accordion: { | ||
description: 'string'; | ||
examples: { | ||
Default: 'string'; | ||
}; | ||
}; | ||
button: { | ||
description: 'string'; | ||
examples: { | ||
Default: 'string'; | ||
}; | ||
}; | ||
}; | ||
server: { | ||
accordion: { | ||
description: 'string'; | ||
examples: { | ||
ContentOutsideSizes: 'string'; | ||
Default: 'string'; | ||
Disabled: 'string'; | ||
Sizes: 'string'; | ||
}; | ||
}; | ||
button: { | ||
description: 'string'; | ||
examples: { | ||
Default: 'string'; | ||
Sizes: 'string'; | ||
Variants: 'string'; | ||
Icons: 'string'; | ||
FullWidth: 'string'; | ||
Disabled: 'string'; | ||
Animations: 'string'; | ||
Multiline: 'string'; | ||
}; | ||
}; | ||
avatar: { | ||
description: 'string'; | ||
examples: { | ||
Active: 'string'; | ||
Default: 'string'; | ||
}; | ||
}; | ||
tag: { | ||
description: 'string'; | ||
examples: { | ||
Default: 'string'; | ||
}; | ||
}; | ||
}; | ||
shared: { | ||
fonts: { | ||
'DMSans-Regular': 'string'; | ||
'DMSans-Semibold': 'string'; | ||
}; | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
workspaces/base/src/button/private/types/ButtonSettingsProps.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,9 @@ | ||
type ButtonVariants = 'primary' | 'secondary' | 'tertiary' | 'ghost'; | ||
type ButtonVariants = | ||
| 'fill' | ||
| 'outline' | ||
| 'ghost' | ||
| 'primary' | ||
| 'secondary' | ||
| 'tertiary'; | ||
|
||
export default ButtonVariants; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
workspaces/base/src/button/private/utils/buttonSizes/getButtonSize.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.