-
Notifications
You must be signed in to change notification settings - Fork 5
Add ProfilePanel component #650
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
Draft
Oksamies
wants to merge
2
commits into
master
Choose a base branch
from
twitch-extension
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
apps/cyberstorm-storybook/stories/components/ProfilePanel.stories.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"extends": "next/core-web-vitals" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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} />; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" }); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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"] | ||
} |
24 changes: 24 additions & 0 deletions
24
...es/cyberstorm/src/components/Layout/TwitchProfilePanelLayout/TwitchProfilePanelLayout.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" }, | ||
], | ||
}; | ||
} |
103 changes: 103 additions & 0 deletions
103
packages/cyberstorm/src/components/ProfilePanel/ProfilePanel.module.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; | ||
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); | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 👍