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

Add ProfilePanel component #650

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { StoryFn, Meta } from "@storybook/react";
import { ProfilePanel } from "@thunderstore/cyberstorm";
import React from "react";

export default {
title: "Cyberstorm/Components/ProfilePanel",
component: ProfilePanel,
} as Meta;

const style: React.CSSProperties = {
height: "500px",
};
const mods = [
{ name: "TestMod1", version: "1.0.0", url: "example.com" },
{ name: "TestMod1", version: "1.0.0", url: "example.com" },
{ name: "TestMod1", version: "1.0.0", url: "example.com" },
{
name: "LongNamedBeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeMod",
version: "1.0.0",
url: "example.com",
},
{ name: "TestMod1", version: "1.0.0", url: "example.com" },
{ name: "TestMod1", version: "1.0.0", url: "example.com" },
{ name: "TestMod1", version: "1.0.0", url: "example.com" },
{ name: "TestMod1", version: "1.0.0", url: "example.com" },
{ name: "TestMod1", version: "1.0.0", url: "example.com" },
{ name: "TestMod1", version: "1.0.0", url: "example.com" },
{ name: "TestMod1", version: "1.0.0", url: "example.com" },
];
const profile = { name: "Test Profile", code: "test_code", mods: mods };

const Template: StoryFn<typeof ProfilePanel> = (args) => (
<div style={style}>
<ProfilePanel {...args} />
</div>
);

const ReferenceProfilePanel = Template.bind({});
ReferenceProfilePanel.args = { profile: profile };

export { ReferenceProfilePanel };
3 changes: 3 additions & 0 deletions apps/twitch-extensions-nextjs/.eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "next/core-web-vitals"
}
35 changes: 35 additions & 0 deletions apps/twitch-extensions-nextjs/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# next.js
/.next/
/out/

# production
/build

# misc
.DS_Store
*.pem

# debug
npm-debug.log*
yarn-debug.log*
yarn-error.log*

# local env files
.env*.local

# vercel
.vercel

# typescript
*.tsbuildinfo
next-env.d.ts
38 changes: 38 additions & 0 deletions apps/twitch-extensions-nextjs/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next-app`](https://github.com/vercel/next.js/tree/canary/packages/create-next-app).

## Getting Started

First, run the development server:

```bash
npm run dev
# or
yarn dev
# or
pnpm dev
```

Open [http://localhost:3000](http://localhost:3000) with your browser to see the result.

You can start editing the page by modifying `pages/index.tsx`. The page auto-updates as you edit the file.

[API routes](https://nextjs.org/docs/api-routes/introduction) can be accessed on [http://localhost:3000/api/hello](http://localhost:3000/api/hello). This endpoint can be edited in `pages/api/hello.ts`.

The `pages/api` directory is mapped to `/api/*`. Files in this directory are treated as [API routes](https://nextjs.org/docs/api-routes/introduction) instead of React pages.

This project uses [`next/font`](https://nextjs.org/docs/basic-features/font-optimization) to automatically optimize and load Inter, a custom Google Font.

## Learn More

To learn more about Next.js, take a look at the following resources:

- [Next.js Documentation](https://nextjs.org/docs) - learn about Next.js features and API.
- [Learn Next.js](https://nextjs.org/learn) - an interactive Next.js tutorial.

You can check out [the Next.js GitHub repository](https://github.com/vercel/next.js/) - your feedback and contributions are welcome!

## Deploy on Vercel

The easiest way to deploy your Next.js app is to use the [Vercel Platform](https://vercel.com/new?utm_medium=default-template&filter=next.js&utm_source=create-next-app&utm_campaign=create-next-app-readme) from the creators of Next.js.

Check out our [Next.js deployment documentation](https://nextjs.org/docs/deployment) for more details.
10 changes: 10 additions & 0 deletions apps/twitch-extensions-nextjs/next.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const withPreconstruct = require("@preconstruct/next");

/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
transpilePackages: ["react"],
output: "export",
};

module.exports = withPreconstruct(nextConfig);
25 changes: 25 additions & 0 deletions apps/twitch-extensions-nextjs/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"name": "@thunderstore/twitch-extensions-nextjs",
"version": "0.1.0",
"private": true,
"scripts": {
"dev": "next dev",
"build": "next build",
"start": "next start",
"lint": "next lint"
},
"dependencies": {
"@preconstruct/next": "^4.0.0",
"@thunderstore/cyberstorm": "^0.1.0",
"@thunderstore/cyberstorm-styles": "^0.1.0",
"@types/node": "18.15.11",
"@types/react": "18.0.35",
"@types/react-dom": "18.0.11",
"eslint": "8.38.0",
"eslint-config-next": "13.3.0",
"next": "13.3.0",
"react": "18.2.0",
"react-dom": "18.2.0",
"typescript": "5.0.4"
}
}
6 changes: 6 additions & 0 deletions apps/twitch-extensions-nextjs/pages/_app.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { AppProps } from "next/app";
import "@thunderstore/cyberstorm-styles";

export default function App({ Component, pageProps }: AppProps) {
return <Component {...pageProps} />;
}
13 changes: 13 additions & 0 deletions apps/twitch-extensions-nextjs/pages/_document.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { Html, Head, Main, NextScript } from "next/document";

export default function Document() {
return (
<Html lang="en">
<Head></Head>
<body>
<Main />
<NextScript />
</body>
</Html>
);
}
13 changes: 13 additions & 0 deletions apps/twitch-extensions-nextjs/pages/api/hello.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
import type { NextApiRequest, NextApiResponse } from "next";

type Data = {
name: string;
};

export default function handler(
req: NextApiRequest,
res: NextApiResponse<Data>
) {
res.status(200).json({ name: "John Doe" });
}
9 changes: 9 additions & 0 deletions apps/twitch-extensions-nextjs/pages/twitchpanel.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { TwitchProfilePanelLayout } from "@thunderstore/cyberstorm";

export default function Communities() {
return (
<div>
<TwitchProfilePanelLayout />
</div>
);
}
Binary file added apps/twitch-extensions-nextjs/public/favicon.ico
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/twitch-extensions-nextjs/public/next.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions apps/twitch-extensions-nextjs/public/vercel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions apps/twitch-extensions-nextjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"paths": {
"@/*": ["./*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", "pages/twitchpanel.html"],
"exclude": ["node_modules"]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { ProfilePanel } from "../../ProfilePanel/ProfilePanel";

/**
* Cyberstorm TwitchPanelLayout Layout
*/
export function TwitchProfilePanelLayout() {
const profile = getProfileData();
return <ProfilePanel profile={profile} />;
}

TwitchProfilePanelLayout.displayName = "ProfilePanelLayout";
TwitchProfilePanelLayout.defaultProps = {};

function getProfileData() {
return {
code: "TEST_CODE",
name: "TEST_NAME",
mods: [
{ name: "TEST_MOD_NAME_1", version: "0.0.1", url: "example.com" },
{ name: "TEST_MOD_NAME_2", version: "0.0.2", url: "example.com" },
{ name: "TEST_MOD_NAME_3", version: "0.0.3", url: "example.com" },
],
};
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
/* Common PackageCard styles */
.root {
display: flex;
flex-direction: column;
gap: var(--gap--12);
align-items: center;
width: 318px;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very specific sizing, and not using rems. Is this something that Twitch requires?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, they have a fixed max size for the panels 👍

height: 496px;
padding: var(--space--20);
border-radius: var(--border-radius--16);
background: linear-gradient(to right bottom, #9d30e4 0%, #23ffb0 100%);
}

.header {
display: flex;
flex-direction: column;
gap: var(--gap--12);
align-items: center;
}

.logo {
display: flex;
flex-direction: row;
gap: var(--gap--8);
align-items: center;
}

.title {
color: var(--color-default);
font: var(--font-body);
font-weight: 700;
line-height: var(--line-height--18);
}

.profileTitle {
color: var(--color-default);
font: var(--font-body);
font-weight: 700;
line-height: var(--line-height--18);
}

.content {
display: flex;
flex-direction: column;
flex-grow: 1;
gap: var(--gap--12);
padding: var(--space--10) var(--space--20) var(--space--20);
overflow-y: scroll;
}

.modrow {
display: flex;
flex-direction: row;
gap: var(--gap--4);
align-items: center;
justify-content: space-between;
padding: var(--space--10);
border-radius: var(--space--10);
background-color: var(--color-default);
}

.modInfo {
display: flex;
flex-basis: 85%;
flex-flow: column;
align-items: flex-start;
text-overflow: ellipsis;
overflow-wrap: anywhere;
}

.modName {
color: var(--color-highlight);
font: var(--font-body);
font-weight: 700;
line-height: var(--line-height--18);
}

.modVersion {
color: var(--color-text--default);
font: var(--font-body);
font-weight: 400;
font-size: var(--font-size--14);
line-height: var(--line-height--18);
}

.modLink {
color: var(--color-highlight);
}

.content::-webkit-scrollbar {
width: 12px;
border-radius: 10px;
background-color: #0000;
}

.content::-webkit-scrollbar-track {
border-radius: 10px;
}

.content::-webkit-scrollbar-thumb {
border-radius: 10px;
background-image: var(--color-gradient-purple-green--darker);
}
Loading