-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This will be used by the twitch panel extension refs -
- Loading branch information
Showing
4 changed files
with
204 additions
and
0 deletions.
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 }; |
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); | ||
} |
59 changes: 59 additions & 0 deletions
59
packages/cyberstorm/src/components/ProfilePanel/ProfilePanel.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,59 @@ | ||
import React from "react"; | ||
import styles from "./ProfilePanel.module.css"; | ||
import { faArrowUpRightFromSquare } from "@fortawesome/free-solid-svg-icons"; | ||
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; | ||
import { ThunderstoreLogo } from "../ThunderstoreLogo/ThunderstoreLogo"; | ||
import { Title } from "../Title/Title"; | ||
|
||
export interface ProfileModsProps { | ||
name: string; | ||
version: string; | ||
url: string; | ||
} | ||
|
||
export interface ProfileProps { | ||
code: string; | ||
name: string; | ||
mods: ProfileModsProps[]; | ||
} | ||
|
||
export interface ProfilePanelProps { | ||
profile: ProfileProps; | ||
} | ||
|
||
/** | ||
* Cyberstorm ProfilePanel component | ||
*/ | ||
export const ProfilePanel: React.FC<ProfilePanelProps> = (props) => { | ||
const { profile } = props; | ||
|
||
return ( | ||
<div className={styles.root}> | ||
<div className={styles.header}> | ||
<div className={styles.logo}> | ||
<ThunderstoreLogo /> | ||
<Title size="smaller" text="Thunderstore" /> | ||
</div> | ||
<div className={styles.profileTitle}>Profile: {profile.name}</div> | ||
<div className={styles.profileTitle}>Code: {profile.code}</div> | ||
</div> | ||
<div className={styles.content}> | ||
{profile.mods.map(function (mod, i) { | ||
return ( | ||
<div key={String(i)} className={styles.modrow}> | ||
<div className={styles.modInfo}> | ||
<div className={styles.modName}>{mod.name}</div> | ||
<div className={styles.modVersion}>{mod.version}</div> | ||
</div> | ||
<a className={styles.modLink} href={mod.url}> | ||
<FontAwesomeIcon fixedWidth icon={faArrowUpRightFromSquare} /> | ||
</a> | ||
</div> | ||
); | ||
})} | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
ProfilePanel.displayName = "ProfilePanel"; |
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