Skip to content

Commit

Permalink
Example lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
bbazukun123 committed Oct 28, 2024
1 parent bacd787 commit a937ac3
Show file tree
Hide file tree
Showing 41 changed files with 3,726 additions and 3,546 deletions.
101 changes: 51 additions & 50 deletions src/stories/button/ButtonContainerSprite.stories.ts
Original file line number Diff line number Diff line change
@@ -1,59 +1,60 @@
import { Container, Graphics, Text } from "pixi.js";
import { PixiStory, StoryFn } from "@pixi/storybook-renderer";
import { ButtonContainer } from "../../Button";
import { centerElement } from "../../utils/helpers/resize";
import { argTypes, getDefaultArgs } from "../utils/argTypes";
import { action } from "@storybook/addon-actions";
import { Container, Graphics, Text } from 'pixi.js';
import { PixiStory, StoryFn } from '@pixi/storybook-renderer';
import { ButtonContainer } from '../../Button';
import { centerElement } from '../../utils/helpers/resize';
import { argTypes, getDefaultArgs } from '../utils/argTypes';
import { action } from '@storybook/addon-actions';

const args = {
color: "#A5E24D",
size: 150,
radius: 150,
disabled: false,
action: action("Button"),
color: '#A5E24D',
size: 150,
radius: 150,
disabled: false,
action: action('Button'),
};

export const ButtonContainerSprite: StoryFn<typeof args> = (
{ size, color, disabled, radius, action },
context,
) =>
new PixiStory<typeof args>({
{ size, color, disabled, radius, action },
context,
init(view) {
// Component usage !!!
const button = new ButtonContainer();

button.enabled = !disabled;

button.onPress.connect(() => action("onPress"));
button.onDown.connect(() => action("onDown"));
button.onUp.connect(() => action("onUp"));
button.onHover.connect(() => action("onHover"));
button.onOut.connect(() => action("onOut"));
button.onUpOut.connect(() => action("onUpOut"));

const buttonView = new Container();
const buttonBg = new Graphics()
.roundRect(0, 0, size, size, radius)
.fill(color);
const text = new Text({ text: "🤙", style: { fontSize: 70 } });

text.anchor.set(0.5);
text.x = buttonBg.width / 2;
text.y = buttonBg.height / 2;

buttonView.addChild(buttonBg, text);

button.addChild(buttonView);
view.addChild(button);

centerElement(button);
},
resize: (view) => centerElement(view.children[0]),
});
) =>
new PixiStory<typeof args>({
context,
init(view)
{
// Component usage !!!
const button = new ButtonContainer();

button.enabled = !disabled;

button.onPress.connect(() => action('onPress'));
button.onDown.connect(() => action('onDown'));
button.onUp.connect(() => action('onUp'));
button.onHover.connect(() => action('onHover'));
button.onOut.connect(() => action('onOut'));
button.onUpOut.connect(() => action('onUpOut'));

const buttonView = new Container();
const buttonBg = new Graphics()
.roundRect(0, 0, size, size, radius)
.fill(color);
const text = new Text({ text: '🤙', style: { fontSize: 70 } });

text.anchor.set(0.5);
text.x = buttonBg.width / 2;
text.y = buttonBg.height / 2;

buttonView.addChild(buttonBg, text);

button.addChild(buttonView);
view.addChild(button);

centerElement(button);
},
resize: (view) => centerElement(view.children[0]),
});

export default {
title: "Components/Button/Button Container Sprite",
argTypes: argTypes(args),
args: getDefaultArgs(args),
title: 'Components/Button/Button Container Sprite',
argTypes: argTypes(args),
args: getDefaultArgs(args),
};
97 changes: 49 additions & 48 deletions src/stories/button/ButtonGraphics.stories.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,58 @@
import { Container, Graphics, Text } from "pixi.js";
import { PixiStory, StoryFn } from "@pixi/storybook-renderer";
import { Button } from "../../Button";
import { centerElement } from "../../utils/helpers/resize";
import { argTypes, getDefaultArgs } from "../utils/argTypes";
import { action } from "@storybook/addon-actions";
import { Container, Graphics, Text } from 'pixi.js';
import { PixiStory, StoryFn } from '@pixi/storybook-renderer';
import { Button } from '../../Button';
import { centerElement } from '../../utils/helpers/resize';
import { argTypes, getDefaultArgs } from '../utils/argTypes';
import { action } from '@storybook/addon-actions';

const args = {
color: "#A5E24D",
size: 150,
radius: 150,
disabled: false,
action: action("Button"),
color: '#A5E24D',
size: 150,
radius: 150,
disabled: false,
action: action('Button'),
};

export const UseGraphics: StoryFn<typeof args> = (
{ size, color, disabled, radius, action },
context,
) =>
new PixiStory<typeof args>({
{ size, color, disabled, radius, action },
context,
init: (view) => {
const buttonView = new Container();
const buttonBg = new Graphics()
.roundRect(0, 0, size, size, radius)
.fill(color);
const text = new Text({ text: "🤙", style: { fontSize: 70 } });

text.anchor.set(0.5);
text.x = buttonBg.width / 2;
text.y = buttonBg.height / 2;

buttonView.addChild(buttonBg, text);

// Component usage !!!
const button = new Button(buttonView);

button.enabled = !disabled;

button.onPress.connect(() => action("onPress"));
button.onDown.connect(() => action("onDown"));
button.onUp.connect(() => action("onUp"));
button.onHover.connect(() => action("onHover"));
button.onOut.connect(() => action("onOut"));
button.onUpOut.connect(() => action("onUpOut"));
view.addChild(buttonView);

centerElement(buttonView);
},
resize: (view) => centerElement(view.children[0]),
});
) =>
new PixiStory<typeof args>({
context,
init: (view) =>
{
const buttonView = new Container();
const buttonBg = new Graphics()
.roundRect(0, 0, size, size, radius)
.fill(color);
const text = new Text({ text: '🤙', style: { fontSize: 70 } });

text.anchor.set(0.5);
text.x = buttonBg.width / 2;
text.y = buttonBg.height / 2;

buttonView.addChild(buttonBg, text);

// Component usage !!!
const button = new Button(buttonView);

button.enabled = !disabled;

button.onPress.connect(() => action('onPress'));
button.onDown.connect(() => action('onDown'));
button.onUp.connect(() => action('onUp'));
button.onHover.connect(() => action('onHover'));
button.onOut.connect(() => action('onOut'));
button.onUpOut.connect(() => action('onUpOut'));
view.addChild(buttonView);

centerElement(buttonView);
},
resize: (view) => centerElement(view.children[0]),
});

export default {
title: "Components/Button/Use Graphics",
argTypes: argTypes(args),
args: getDefaultArgs(args),
title: 'Components/Button/Use Graphics',
argTypes: argTypes(args),
args: getDefaultArgs(args),
};
Loading

0 comments on commit a937ac3

Please sign in to comment.