Skip to content

Commit 9971f3b

Browse files
committed
autosort creator codes
1 parent a2ba132 commit 9971f3b

File tree

3 files changed

+21
-19
lines changed

3 files changed

+21
-19
lines changed

components/CreatorCode.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ interface Props {
99
percentOff: number;
1010
}
1111

12-
const CreatorCode: React.FC<Props> = ({storeName, storeLink, storeImage, code, percentOff}) => {
12+
const CreatorCode: React.FC<Props> = ([storeName, storeLink, code, percentOff, storeImage]) => {
1313
const [copied, setCopied] = React.useState(false)
1414

1515
function copyCode() {

components/CreatorCodes.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
const CreatorCodes: React.FC<{children: React.ReactNode}> = ({children}) => {
1+
import CreatorCode from '@components/CreatorCode'
22

3-
return <div className="grid md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 grid-cols-1 mt-4 gap-4">
4-
{children}
5-
</div>
3+
function CreatorCodes (data: [string, string, string, number, string][]) {
4+
return (<div className="grid md:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 grid-cols-1 mt-4 gap-4">
5+
{data
6+
.sort((a, b) => a[0].localeCompare(b[0]))
7+
.map((creator) => CreatorCode(creator))}
8+
</div>)
69
}
710

811
export default CreatorCodes

pages/index.mdx

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,19 +42,18 @@ Creator codes allow Tebex stores to share a percentage of a purchase with us, wh
4242

4343
More information about these creators is available in our [Discord](https://discord.com/channels/813030955598086174/1028912864389496903).
4444

45-
<CreatorCodes>
46-
<CreatorCode storeName="Andyyy" storeLink="https://andyyy.tebex.io/" code="ox20" percentOff={20} storeImage="/static/creators/andy.png"/>
47-
<CreatorCode storeName="Berkie's Workshop" storeLink="https://berkie.tebex.io/" code="ox10" percentOff={10} storeImage="/static/creators/berkie.png"/>
48-
<CreatorCode storeName="Dolu Mods" storeLink="https://dolu.tebex.io/" code="overextended" percentOff={25} storeImage="/static/creators/dolu.png"/>
49-
<CreatorCode storeName="Electus Scripts" storeLink="https://store.electus-scripts.com/" code="ox10" percentOff={10} storeImage="/static/creators/electus.png"/>
50-
<CreatorCode storeName="Loaf Scripts" storeLink="https://store.loaf-scripts.com/" code="ox10" percentOff={10} storeImage="/static/creators/loaf.png"/>
51-
<CreatorCode storeName="OT Studios" storeLink="https://store.otstudios.net/ox" code="ox10" percentOff={10} storeImage="/static/creators/otstudios.png"/>
52-
<CreatorCode storeName="Randolio Scripts" storeLink="https://randolio.tebex.io/" code="OVEREXTENDED" percentOff={20} storeImage="/static/creators/randolio.png"/>
53-
<CreatorCode storeName="rcore" storeLink="https://store.rcore.cz/" code="ox10" percentOff={10} storeImage="/static/creators/rcore.png"/>
54-
<CreatorCode storeName="Artwork Inventory" storeLink="https://artwork-inventory.tebex.io/" code="ox10" percentOff={10} storeImage="/static/creators/artworkInventory.gif"/>
55-
<CreatorCode storeName="Renewed Scripts" storeLink="https://renewed.tebex.io/ox" code="ox15" percentOff={15} storeImage="/static/creators/renewed.png"/>
56-
<CreatorCode storeName="Wasabi Scripts" storeLink="https://store.wasabiscripts.com/ox" code="OX20" percentOff={20} storeImage="/static/creators/wasabi.png"/>
57-
</CreatorCodes>
58-
45+
{CreatorCodes([
46+
["Andyyy", "https://andyyy.tebex.io/", "ox20", 20 , "/static/creators/andy.png"],
47+
["Berkie's Workshop", "https://berkie.tebex.io/", "ox10", 10 , "/static/creators/berkie.png"],
48+
["Dolu Mods", "https://dolu.tebex.io/", "overextended", 25 , "/static/creators/dolu.png"],
49+
["Electus Scripts", "https://store.electus-scripts.com/", "ox10", 10 , "/static/creators/electus.png"],
50+
["Loaf Scripts", "https://store.loaf-scripts.com/", "ox10", 10 , "/static/creators/loaf.png"],
51+
["OT Studios", "https://store.otstudios.net/ox", "ox10", 10 , "/static/creators/otstudios.png"],
52+
["Randolio Scripts", "https://randolio.tebex.io/", "OVEREXTENDED", 20 , "/static/creators/randolio.png"],
53+
["rcore", "https://store.rcore.cz/", "ox10", 10 , "/static/creators/rcore.png"],
54+
["Artwork Inventory", "https://artwork-inventory.tebex.io/", "ox10", 10 , "/static/creators/artworkInventory.gif"],
55+
["Renewed Scripts", "https://renewed.tebex.io/ox", "ox15", 15 , "/static/creators/renewed.png"],
56+
["Wasabi Scripts", "https://store.wasabiscripts.com/ox", "OX20", 20 , "/static/creators/wasabi.png"]
57+
])}
5958

6059
You can apply a creator code at checkout under "Support A Creator".

0 commit comments

Comments
 (0)