Skip to content

Commit

Permalink
feat(star-rating): code clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelojcs committed Nov 13, 2024
1 parent 04022b2 commit 29ae324
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { html } from 'lit';
import { ifDefined } from 'lit/directives/if-defined';
import '../index';
import readme from './README.stories.mdx';
import { bxGrid8ColCentered } from '../../../globals/internal/storybook-decorators';
import { Grid8ColCentered } from '../../../globals/internal/storybook-decorators';
import { boolean, number, text } from '@storybook/addon-knobs';

export const Default = (args) => {
Expand Down Expand Up @@ -41,20 +41,11 @@ export const NoLabel = (args) => {
`;
};

NoLabel.argTypes = {
label: {
table: { disable: true },
},
labelHref: {
table: { disable: true },
},
};

export default {
title: 'Components/Star Rating',
parameters: {
...readme.parameters,
hasStoryPaddin: true,
hasStoryPadding: true,
knobs: {
StarRating: () => {
const rating = number('Star Rating', 4.5);
Expand All @@ -75,7 +66,7 @@ export default {
},
},
decorators: [
(story) => bxGrid8ColCentered(story),
(story) => Grid8ColCentered(story),
(story) => html` <div style="margin-block-start: 2rem;">${story()}</div> `,
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { html } from 'lit';
* @param story Storybook story
* @returns {TemplateResult}
*/
export const bxGridNoCol = (story) => html`
export const GridNoCol = (story) => html`
<div class="cds--grid c4d-story-padding">
<div class="cds--row">${story instanceof Function ? story() : story}</div>
</div>
Expand All @@ -27,16 +27,16 @@ export const bxGridNoCol = (story) => html`
* @param story Storybook story
* @returns {TemplateResult}
*/
export const bxGrid16Col = (story) =>
bxGridNoCol(html` <div class="cds--col-lg-16">${story()}</div> `);
export const Grid16Col = (story) =>
GridNoCol(html` <div class="cds--col-lg-16">${story()}</div> `);

/**
* Wraps provided Storybook story in Carbon grid with a half-width, centered column.
*
* @param story Storybook story
* @returns {TemplateResult}
*/
export const bxGrid8ColCentered = (story) =>
bxGridNoCol(
export const Grid8ColCentered = (story) =>
GridNoCol(
html` <div class="cds--offset-lg-4 cds--col-lg-8">${story()}</div> `
);

0 comments on commit 29ae324

Please sign in to comment.