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

feat(common):[components] add WIconButton #304

Closed
wants to merge 1 commit into from
Closed
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
22 changes: 22 additions & 0 deletions src/common/components/WIconButton/index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@import '@/common/scss/colors.scss';
@import '@/common/scss/sizes.scss';

.w-icon-button {
width: 44px;
height: 44px;
padding: 2px;
border-radius: calc($s-border-radius + 2px);
background-color: $c-bg-white;
cursor: pointer;
display: flex;
align-items: center;
justify-content: center;
&-big{
width: 56px;
height: 56px;
}
&-small{
width: 30px;
height: 30px;
}
}
25 changes: 25 additions & 0 deletions src/common/components/WIconButton/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import React from 'react';
import SImageVector from '../SImageVector/index';
//--stylesheet-----------------------------------------------------------------------------------
import './index.scss';

interface Props {
size: 'big' | 'small';
content: string;
handlerClick: CallableFunction;
}

//--component definition-------------------------------------------------------------------------

const WIconButton: React.FC<Props> = ({ size, content, handlerClick }) => {
return (
<div
className={`w-icon-button w-icon-button-${size}`}
onClick={() => handlerClick()}
>
<SImageVector content={content} />
</div>
);
};

export default WIconButton;
34 changes: 34 additions & 0 deletions src/common/components/WIconButton/insex.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import type { Meta, StoryObj } from '@storybook/react';
import { linkTo } from '@storybook/addon-links';
import WIconButton from '.';

//-------------------------------------------------------------------------------------------------


export default {
title: 'Common/WIconButton',
component: WIconButton,
parameters: {
layout: 'centered',
},
} as Meta<typeof WIconButton>;

type Story = StoryObj<typeof WIconButton>;

//-------------------------------------------------------------------------------------------------

export const Big: Story = {
args: {
size: 'big',
content: '',
handlerClick: linkTo('Common/WIconButton', 'Small'),
},
};

export const Small: Story = {
args: {
size: 'small',
content: '',
handlerClick: linkTo('Common/WIconButton', 'Big'),
},
};
1 change: 1 addition & 0 deletions src/common/components/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ export { default as WTextButton } from './WTextButton';
export { default as SImage } from './SImage';
export { default as SImageVector } from './SImageVector';
export { default as SImageRaster } from './SImageRaster';
export { default as WIconButton } from './WIconButton';