Skip to content
Snippets Groups Projects
Commit c78519c7 authored by Дмитрий Малюгин's avatar Дмитрий Малюгин :clock4:
Browse files

refactor: component 'Button' (add 'padding' prop)

parent a920a2dd
No related branches found
No related tags found
1 merge request!3Table (partially), Checkbox, Tag, Select and Knob
...@@ -15,6 +15,7 @@ const meta: Meta = { ...@@ -15,6 +15,7 @@ const meta: Meta = {
}, },
argTypes: { argTypes: {
label: { control: 'text' }, label: { control: 'text' },
padding: { control: 'text' },
size: { control: 'select', options: ['small', 'normal', 'large', 'huge'] }, size: { control: 'select', options: ['small', 'normal', 'large', 'huge'] },
textStyle: { control: 'select', options: ['bold', 'italic'] }, textStyle: { control: 'select', options: ['bold', 'italic'] },
iconPos: { control: 'select', options: ['left', 'top', 'right', 'bottom'] }, iconPos: { control: 'select', options: ['left', 'top', 'right', 'bottom'] },
......
...@@ -18,7 +18,7 @@ const color = computed(() => ...@@ -18,7 +18,7 @@ const color = computed(() =>
: convertThemeToTextColor(props.theme, props.darknessTheme), : convertThemeToTextColor(props.theme, props.darknessTheme),
); );
const borderColor = computed(() => convertThemeToSecondaryColor(props.theme, props.darknessTheme)); const borderColor = computed(() => convertThemeToSecondaryColor(props.theme, props.darknessTheme));
const width = computed(() => (props.width ? `${props.width}px` : 'max-content')); const width = computed(() => (props.width ? props.width : 'max-content'));
const textSize = computed(() => { const textSize = computed(() => {
switch (props.size) { switch (props.size) {
case 'small': case 'small':
...@@ -31,15 +31,16 @@ const textSize = computed(() => { ...@@ -31,15 +31,16 @@ const textSize = computed(() => {
return '16px'; return '16px';
}); });
const buttonPadding = computed(() => { const buttonPadding = computed(() => {
if (props.padding) return props.padding;
switch (props.size) { switch (props.size) {
case 'small': case 'small':
return '0.5rem 0.375rem'; return '0.5rem';
case 'large': case 'large':
return '1.2rem 0.8rem'; return '1.2rem';
case 'huge': case 'huge':
return '1.8rem 1.2rem'; return '1.8rem';
} }
return '0.75rem 0.5rem'; return '0.75rem';
}); });
</script> </script>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment