Skip to content
Open
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
4 changes: 2 additions & 2 deletions src/components/counter/counter.stories.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { StoryObj, Meta } from '@storybook/html';

import { counter } from './index';
import { Counter } from './index';

// More on how to set up stories at: https://storybook.js.org/docs/html/writing-stories/introduction#default-export
const meta = {
Expand All @@ -12,7 +12,7 @@ const meta = {
render: () => {
// You can either use a function to create DOM elements or use a plain html string!
// return `<div>${label}</div>`;
return counter();
return Counter();
},
} satisfies Meta;

Expand Down
11 changes: 0 additions & 11 deletions src/components/counter/index.js

This file was deleted.

19 changes: 19 additions & 0 deletions src/components/counter/index.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import './counter.css';
import React from "react";
import { useState } from "react"
export function Counter() {

const[counter, setCounter] = useState(0)

function upCounter() {
setCounter(counter + 1)
}

return (
<div className="Card">
<button onClick={upCounter} id="counter" type="button">
count is {counter}
</button>
</div>
);
}
14 changes: 7 additions & 7 deletions src/components/logo/index.js → src/components/logo/index.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import './logo.css'

import React from 'react';

/**
* @typedef {Object} LogoProps
* @property {string} LogoProps.link - some description here
* @property {string} LogoProps.imgSrc - some description here
* @property {string} LogoProps.descricao - some description here
*
*
* @param {LogoProps} props
*/
export function logo({link, imgSrc, descricao}) {
return `
<a class="logo" href="${link}" target="_blank">
<img src="${imgSrc}" class="logo" alt="${descricao}" />
export function Logo({link, imgSrc, descricao}) {
return (
<a className="logo" href={link} target="_blank">
<img src={imgSrc} className="logo" alt={descricao} />
</a>
`
)
}
4 changes: 2 additions & 2 deletions src/components/logo/logo.stories.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type { StoryObj, Meta } from '@storybook/html';

import { logo } from './index';
import { Logo } from './index';
import type {LogoProps} from './index';

// More on how to set up stories at: https://storybook.js.org/docs/html/writing-stories/introduction#default-export
const meta = {
title: 'App/Logo',
tags: ['autodocs'],
render: (args) => {
return logo(args);
return Logo(args);
},
argTypes: {
link: {description: 'endereço para o link do logo'},
Expand Down
41 changes: 21 additions & 20 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,33 +5,34 @@ import viteLogo from '/vite.svg'
import storybookLogo from '/storybook.svg'
import { $ } from "./select";
import './style.css'
import { logo } from "./components/logo";
import { counter } from "./components/counter";
import { Logo } from "./components/logo";
import { Counter } from "./components/counter";

const app = $("#app");

ReactDOM.createRoot(app).render(
<React.StrictMode>
<div>
<h2> REACT VERSION</h2>
{logo({
link: "https://vitejs.dev",
imgSrc: viteLogo,
descricao: "Vite logo",
})}
$
{logo({
link: "https://www.typescriptlang.org/",
imgSrc: typescriptLogo,
descricao: "TypeScript logo",
})}
$
{logo({
link: "https://storybookjs.org/",
imgSrc: storybookLogo,
descricao: "Storybook logo",
})}
<h1>Vite + TypeScript + Storybook</h1>${counter()}
<Logo
link= "https://vitejs.dev"
imgSrc= {viteLogo}
descricao="Vite logo"
></Logo>

<Logo
link= "https://www.typescriptlang.org/"
imgSrc= {typescriptLogo}
descricao= "TypeScript logo"
></Logo>

<Logo
link= "https://storybookjs.org/"
imgSrc= {storybookLogo}
descricao= "Storybook logo"
></Logo>
<h1>Vite + TypeScript + Storybook</h1>
<Counter></Counter>
<p className="read-the-docs">
Click on the Vite, TypeScript and Storybook logos to learn more
</p>
Expand Down