-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from Lilypad-Tech/nadiem/feat-add-leaderboard-…
…block-cards Nadiem/feat add leaderboard block cards
- Loading branch information
Showing
7 changed files
with
218 additions
and
8 deletions.
There are no files selected for viewing
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
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
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,33 @@ | ||
import { AnchorHTMLAttributes, HTMLAttributes } from "react"; | ||
import { color, destructive, hierarchy, size } from "./AnchorTypes"; | ||
import AnchorWrapper from "./AnchorWrapper"; | ||
import AnchorTextAtom from "./AnchorTextAtom"; | ||
|
||
interface AnchorProps extends AnchorHTMLAttributes<HTMLAnchorElement> { | ||
size: size; | ||
destructive: destructive; | ||
color: color; | ||
hierarchy: hierarchy; | ||
} | ||
const Anchor = ({ | ||
size, | ||
destructive, | ||
color, | ||
hierarchy, | ||
...props | ||
}: AnchorProps) => { | ||
return ( | ||
<AnchorWrapper | ||
size={size} | ||
destructive={destructive} | ||
color={color} | ||
hierarchy={hierarchy} | ||
{...props} | ||
className={`${props.className}`} | ||
> | ||
<AnchorTextAtom size={size}>{props.children}</AnchorTextAtom> | ||
</AnchorWrapper> | ||
); | ||
}; | ||
|
||
export default Anchor; |
26 changes: 26 additions & 0 deletions
26
apps/info-dashboard/src/components/Anchor/AnchorTextAtom.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,26 @@ | ||
import { HTMLAttributes } from "react"; | ||
import { size } from "./AnchorTypes"; | ||
|
||
interface AnchorTextAtomProps extends HTMLAttributes<HTMLSpanElement> { | ||
size: size; | ||
} | ||
|
||
const AnchorTextAtom = ({ size, children, ...props }: AnchorTextAtomProps) => { | ||
const textSizes = { | ||
md: " uui-text-sm ", | ||
}; | ||
|
||
const layer1 = | ||
" pointer-events-none font-semibold whitespace-nowrap px-uui-xxs "; | ||
|
||
return ( | ||
<span | ||
{...props} | ||
className={`${props.className} ${textSizes[size]} ${layer1}`} | ||
> | ||
{children} | ||
</span> | ||
); | ||
}; | ||
|
||
export default AnchorTextAtom; |
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,7 @@ | ||
export type destructive = boolean; | ||
|
||
export type color = "color"; | ||
|
||
export type hierarchy = "primary"; | ||
|
||
export type size = "md"; |
80 changes: 80 additions & 0 deletions
80
apps/info-dashboard/src/components/Anchor/AnchorWrapper.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,80 @@ | ||
import { HTMLAttributes } from "react"; | ||
import { color, destructive, hierarchy, size } from "./AnchorTypes"; | ||
|
||
interface AnchorWrapperProps extends HTMLAttributes<HTMLAnchorElement> { | ||
size: size; | ||
destructive: destructive; | ||
color: color; | ||
hierarchy: hierarchy; | ||
} | ||
|
||
type Coloring = { | ||
[D in `${destructive}`]: { | ||
[H in hierarchy]: { | ||
color: string[]; | ||
}; | ||
}; | ||
}; | ||
|
||
export const AnchorWrapper = ({ | ||
children, | ||
size, | ||
destructive, | ||
color, | ||
hierarchy, | ||
...props | ||
}: AnchorWrapperProps) => { | ||
const layer1 = | ||
" group flex justify-center items-center [&.disabled]:pointer-events-none uui-focus-all:outline-none [&.disabled]:text-uui-fg-disabled [&.disabled]:pointer-events-none "; | ||
const shadow = " shadow-uui-xs "; | ||
|
||
const wrapperSizes = { | ||
md: " p-[var(--uui-spacing-2-5)] px-[var(--uui-spacing-3-5)] ", | ||
}; | ||
|
||
const coloring = { | ||
false: { | ||
primary: { | ||
color: [ | ||
"bg-uui-button-primary-bg", | ||
"text-uui-button-primary-fg", | ||
"border-uui-button-primary-bg", | ||
"border", | ||
"rounded-uui-3xl", | ||
"border-solid", | ||
// hover | ||
"uui-hover-all:bg-uui-button-primary-bg_hover", | ||
"uui-hover-all:text-uui-button-primary-fg_hover", | ||
"uui-hover-all:border-uui-button-primary-border_hover", | ||
// focus | ||
"uui-focus-all:uui-ring-brand", | ||
"uui-focus-all:shadow-uui-xs", | ||
// disabled | ||
"[&.disabled]:bg-uui-bg-disabled", | ||
"[&.disabled]:border-uui-border-disabled_subtle", | ||
], | ||
}, | ||
}, | ||
// empty for now, will add in correct styles when needed | ||
true: { | ||
primary: { | ||
color: [], | ||
}, | ||
}, | ||
}; | ||
|
||
const destructiveColoring = destructive.toString() as keyof Coloring; | ||
|
||
return ( | ||
<a | ||
{...props} | ||
className={` ${props.className} ${layer1} ${shadow} ${ | ||
wrapperSizes[size] | ||
} ${coloring[destructiveColoring][hierarchy][color].join(" ")}`} | ||
> | ||
{children} | ||
</a> | ||
); | ||
}; | ||
|
||
export default AnchorWrapper; |
23 changes: 19 additions & 4 deletions
23
apps/info-dashboard/src/components/CardWithBorder/CardWithBorder.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