Skip to content

Commit 4db0457

Browse files
committed
New org name and improved docs
1 parent ed0476d commit 4db0457

File tree

9 files changed

+1605
-3681
lines changed

9 files changed

+1605
-3681
lines changed

apps/exo-ui.dev/src/components/Editor.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ export const Editor = (props: Parameters<typeof SandpackProvider>) => (
1717
template="react-ts"
1818
customSetup={{
1919
dependencies: {
20-
"@junket/components": "latest"
20+
"@vistas/exo-ui": "latest"
2121
}
2222
}}
2323
>

apps/exo-ui.dev/src/content/docs/overview/philosophies.mdoc

+20-2
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,26 @@ description: Design philosophies behind Exo UI.
55

66
These are the guiding principles used when developing Exo UI.
77

8+
### Remove runtime restrictions
9+
10+
We wanted Exo UI to work any where React worked, namely in the browser and on native devices.
11+
12+
To do this we had to make sure we never referenced any markup directly, this ended up being an advantage as it forced us to create a library free of semantic restrictions.
13+
14+
### Remove semantic restrictions
15+
16+
Ever found the perfect third party library that does everything you want only to find out it's a nightmare to move a button or style an input? Us to! Exo UI was designed from the ground up to only ship functionality, no markup and no stylesheets.
17+
18+
The draw back of an approach like this is it means Exo UI is limited in terms of it's ability to help with things like accessibility and animations, fortunately lots of great tools exist to help with these.
19+
20+
### Remove data restrictions
21+
22+
A lot of third party libraries require you to format your data _their_ way, this can be frustrating, if you already have a `slides` array containing objects with `title` and `image` why should you have to change those objects to have `caption` and `background`?
23+
24+
Exo UI tries to solve this problem by _wrapping_ around your data and never modifying it directly, this does add some verbosity but also allows Exo UI to be very flexible in terms of the _shape_ of data it consumes.
25+
26+
Obviously we do have to make some concesions like expecting an array to be passed to components that iterate over lists, etc...
27+
828
### Single file components
929

1030
You may notice that each component i.e `SingleSelectList` is defined in a single file, including all type definitions.
@@ -20,5 +40,3 @@ The use of memoization in React projects is a [relatively controversial](https:/
2040
We only utilize memoization when it is strictly required, in otherwords when we intend to include a value or function in the dependency array of another value, effect, or function.
2141

2242
If this doesn't make any sense to you don't worry! 99% of the time this shouldn't effect you and should only really be a consideration when contributing directly to the Exo UI source code.
23-
24-
{% editor files=[{ name: "/App.tsx", file: "hello-sandpack.tsx" }] /%}
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
---
2-
title: Add custom actions to fields
3-
description: A guide in my new Starlight docs site.
2+
title: Add custom actions
3+
description: How to extend existing Exo UI functionality
44
---
55

6-
Hello world
6+
Sometimes the functions provided by Exo UI simply aren't enough when dealing with complex business logic.
7+
8+
When you want to extend the functions provided by Exo UI we recommend mapping over the data returned from which ever component you are using and adding a new `custom` key to each item.
9+
10+
**Note:** While any string will work we recommend `custom` because we considered that key _reserved_ and will never ship any logic that would intefer with that.
11+
12+
{% editor files=[{ name: "/App.tsx", file: "add-custom-actions.tsx" }] /%}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
import { createSingleSelectListComponent } from "@vistas/exo-ui";
2+
3+
// @TODO
4+
// - Move this to seperate file and import
5+
const response = [
6+
{
7+
name: "Tom Hanks",
8+
rating: "Over 9000"
9+
},
10+
{
11+
name: "Tom Holland",
12+
rating: "Double Rainbow"
13+
}
14+
];
15+
16+
const { SingleSelectList, useSingleSelectList } = createSingleSelectListComponent<typeof response>();
17+
18+
const Accordions = () => {
19+
const { hydratedItems } = useSingleSelectList();
20+
21+
const customItems = hydratedItems.map(item => ({
22+
...item,
23+
custom: {
24+
select: () => {
25+
// @NOTE
26+
// - Prevent user from closing open accordion
27+
if (item.metadata.isSelected) return;
28+
item.actions.select();
29+
}
30+
}
31+
}))
32+
33+
return (
34+
<>
35+
{customItems.map(({ data, custom, metadata }) => (
36+
<div>
37+
<button onClick={custom.select}>{data.name}</button>
38+
{metadata.isSelected && <p>Is rated: {data.rating}</p>}
39+
</div>
40+
))}
41+
</>
42+
)
43+
}
44+
45+
export default function App() {
46+
return (
47+
<div className="App">
48+
<SingleSelectList.Provider items={response} options={{
49+
initiallySelectedItemIndex: 0
50+
}}>
51+
<p>Actor ratings:</p>
52+
<Accordions />
53+
</SingleSelectList.Provider>
54+
</div>
55+
);
56+
}

apps/exo-ui.dev/src/examples/hello-sandpack.tsx

-34
This file was deleted.

apps/exo-ui.dev/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"extends": "astro/tsconfigs/strictest",
33
"compilerOptions": {
4-
"jsx": "react"
4+
"jsx": "react-jsx"
55
}
66
}

0 commit comments

Comments
 (0)