Skip to content
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

LITE-30099: Update button component to match the design #85

Merged
merged 2 commits into from
May 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions components/src/stories/Button.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { Meta, ArgsTable } from '@storybook/blocks';
import { Figma } from '@storybook/addon-designs/blocks';

<Meta title="Components/Button/Design" />

# Button Design Specification

<Figma
url="https://www.figma.com/file/iWvG1cSD2xzbGS2KAB1DgV/Connect-UI-Guides-%26-Specs?type=design&node-id=1-4009&mode=design&t=5CPLKuHbPQnKMEJh-0"
height="1000%"
/>
<ArgsTable of={Figma} />
45 changes: 40 additions & 5 deletions components/src/stories/Button.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,42 @@ import registerWidget from '~core/registerWidget';

registerWidget('ui-button', Button);

export const Component = {
export const Base = {
name: 'Base component',
render: (args) => ({
setup() {
return { args };
const showAlert = () => alert('The button was clicked');
return { args, showAlert };
},
template: `<ui-button disabled v-bind="args"></ui-button>`,
template: '<ui-button v-bind="args" @clicked="showAlert" />',
}),
args: {
mode: 'solid',
size: 'large',
label: 'Accept',
icon: 'googleCheckBaseline',
iconRight: '',
color: '#2C98F0',
progress: false,
lowerCase: false,
onlyIcon: false,
disabled: false,
},
};

export const Slotted = {
name: 'Using the default slot',
render: (args) => ({
setup() {
const showAlert = () => alert('The button was clicked');
return { args, showAlert };
},
template:
'<ui-button v-bind="args" @clicked="showAlert"><pre style="background-color:darkblue;color:lightcyan;font-style:italic;">Custom slot content</pre></ui-button>',
}),
args: {
text: 'Text',
...Base.args,
label: '',
},
};

Expand All @@ -23,6 +49,15 @@ export default {
layout: 'centered',
},
argTypes: {
text: 'text',
mode: { control: 'radio', options: ['solid', 'flat', 'outlined'] },
size: { control: 'radio', options: ['small', 'large'] },
label: 'text',
icon: 'text',
iconRight: 'text',
color: 'text',
progress: 'boolean',
lowerCase: 'boolean',
onlyIcon: 'boolean',
disabled: 'boolean',
},
};
7 changes: 5 additions & 2 deletions components/src/stories/Menu.stories.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,11 @@ export const Component = {
template: `
<ui-menu v-bind="args">
<ui-button
slot="trigger"
text="open menu"
slot="trigger"
iconRight="googleArrowDropDownBaseline"
label="open menu"
mode="flat"
size="small"
/>
<div style="padding:8px 16px; border:1px solid black;" slot="content">
<p>Lorem ipsum dolor sit amet</p>
Expand Down
Loading