Skip to content
This repository was archived by the owner on Feb 15, 2025. It is now read-only.

Commit 4e813c8

Browse files
authored
Merge pull request #34 from agile-ts/develop
Develop
2 parents d0007b5 + f3cd767 commit 4e813c8

File tree

8 files changed

+102
-19
lines changed

8 files changed

+102
-19
lines changed

docs/Interfaces.md

+77-10
Original file line numberDiff line numberDiff line change
@@ -566,21 +566,88 @@ export interface CollectConfigInterface<DataType = any> {
566566

567567
<br/>
568568

569-
#### `key`
569+
#### `patch`
570570

571-
Key/Name of Selector.
571+
Under the hood it calls the [`patch`](./packages/core/features/state/Methods.md#patch) method
572+
instead of the [`set`](./packages/core/features/state/Methods.md#set) method.
573+
Of course, it is only useful if we patch something into something existing,
574+
what shouldn't be the case in the `collect` method.
572575

573576
| Type | Default | Required |
574577
|--------------------------|-----------|----------|
575-
| `string \| name` | undefined | No |
578+
| `boolean` | false | No |
579+
580+
<br/>
581+
582+
#### `method`
583+
584+
In which way the collected data primary Key gets added to the Groups.
585+
By using `push` it will be added at the end of the primaryKey array
586+
```ts {2}
587+
MY_COLLECTION.collect({id: 1, name: "jeff"}, {method: 'push'});
588+
MY_COLLECTION.getGroup(MY_COLLECTION.config.defaultGroupKey).value; // Returns [5, 6, 0, 1]
589+
```
590+
and by `unshift` it can be found at the beginning of the primaryKey array.
591+
```ts {2}
592+
MY_COLLECTION.collect({id: 8, name: "jeff"}, {method: 'unshift'});
593+
MY_COLLECTION.getGroup(MY_COLLECTION.config.defaultGroupKey).value; // Returns [8, 5, 6, 0, 1]
594+
```
595+
596+
| Type | Default | Required |
597+
|--------------------------|-----------|----------|
598+
| `push' \| 'unshift'` | 'push' | No |
599+
600+
<br/>
601+
602+
#### `forEachItem`
603+
604+
Gets called for each collected Data.
605+
```ts {4-9}
606+
MY_COLLECTION.collect([
607+
{id: 1, name: "jeff"},
608+
{id: 8, name: "frank"}],
609+
{forEachItem: (data, key, index) => {
610+
// Gets Called with data: {id: 1, name: "jeff"}, key: 1, index: 0
611+
// and
612+
// Gets Called with data: {id: 2, name: "frank"}, key: 8, index: 1
613+
}
614+
})
615+
```
616+
617+
| Type | Default | Required |
618+
|-------------------------------------------------------------|-----------|----------|
619+
| `(data: DataType, key: ItemKey, index: number) => void` | undefined | No |
576620

577621
<br/>
578622

623+
#### `background`
579624

580-
| Prop | Type | Default | Description | Required |
581-
|-------------------|--------------------------|-------------|-------------------------------------------------------------------------------------------------------------------------|----------|
582-
| patch | boolean | false | Key/Name of Selector | No |
583-
| method | push' \| 'unshift' | 'push' | If Selector is initially a Placeholder | No |
584-
| forEachItem | boolean | false | If Selector is initially a Placeholder | No |
585-
| background | boolean | false | If Selector is initially a Placeholder | No |
586-
| select | boolean | false | If Selector is initially a Placeholder | No |
625+
Sometimes we want to add new data to our Collection in background,
626+
so that no component rerender that has bound the Collection to itself.
627+
Then this property might get handy.
628+
```ts {5}
629+
// Causes rerender on Components
630+
MY_COLLECTION.collect({id: 1, name: "jeff"});
631+
632+
// Doesn't cause rerender on Comonents
633+
MY_COLLECTION.collect({id: 1, name: "jeff"}, {background: true});
634+
```
635+
636+
| Type | Default | Required |
637+
|--------------------------|-----------|----------|
638+
| `boolean` | false | No |
639+
640+
<br/>
641+
642+
#### `select`
643+
644+
If foreach collected Data a [Selector](./packages/core/features/collection/selector/Introduction.md) gets created,
645+
which is a separate State that represents the Data Value.
646+
```ts {5}
647+
MY_COLLECTION.collect({id: 1, name: "jeff"}, {select: true});
648+
MY_COLLECTION.getSelector(1); // Returns Selector that got just created
649+
```
650+
651+
| Type | Default | Required |
652+
|--------------------------|-----------|----------|
653+
| `boolean` | false | No |

docs/main/Introduction.md

+10
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,16 @@ Test AgileTs yourself, it's only one click away. Just select your preferred Fram
112112

113113
<br />
114114

115+
## 🎉 Credits
116+
117+
AgileTs is inspired by [PulseJs](https://github.com/pulse-framework/pulse)
118+
119+
<br />
120+
121+
---
122+
123+
<br />
124+
115125
## 💬 What others say
116126

117127
Actually nothing, hehe

src/components/buttons/GithubButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const GithubButton: React.FC<Props> = (props) => {
1313
<Container
1414
onClick={() => {
1515
if (to.startsWith("http")) {
16-
window.location.href = to;
16+
window.open(to, "_blank");
1717
return;
1818
}
1919
history.push(to);

src/components/buttons/PrimaryButton.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const PrimaryButton: React.FC<Props> = (props) => {
1212
<Button
1313
onClick={() => {
1414
if (to.startsWith("http")) {
15-
window.location.href = to;
15+
window.open(to, "_blank");
1616
return;
1717
}
1818
history.push(to);

src/css/custom.scss

+8
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@
3939
// Theme Colors
4040
// ==============================================================================
4141

42+
// Primary
43+
// See 'General Docusaurs'
44+
--ifm-color-on-primary: var(--ifm-color-white);
45+
4246
// Background
4347
--ifm-color-background: var(--ifm-color-white);
4448
--ifm-color-background-2: var(--ifm-color-white-dark);
@@ -333,6 +337,10 @@ html[data-theme='dark'] {
333337
// Theme Colors
334338
// ==============================================================================
335339

340+
// Primary
341+
// See 'General Docusaurs'
342+
--ifm-color-on-primary: var(--ifm-color-black);
343+
336344
// Background
337345
--ifm-color-background: var(--ifm-color-black);
338346
--ifm-color-background-2: var(--ifm-color-black-light);

src/pages/LandingPage/components/HeaderView/index.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ const HeaderView: React.FC = () => {
3636
<DescriptionText>{siteConfig.customFields.description}</DescriptionText>
3737
<Spacer height={50} />
3838
<ButtonContainer>
39-
<GetStartedButton to={"/docs"}>GET STARTED</GetStartedButton>
39+
<GetStartedButton to={"/docs/introduction"}>
40+
GET STARTED
41+
</GetStartedButton>
4042
<GithubButtonContainer to={siteConfig.customFields.githubUrl} />
4143
</ButtonContainer>
4244
</ContentContainer>

src/pages/LandingPage/index.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import Layout from "@theme/Layout";
66
import "react-toastify/dist/ReactToastify.css";
77
import HeaderView from "./components/HeaderView";
88
import useDocusaurusContext from "@docusaurus/useDocusaurusContext";
9-
import GiveItATryView from "./components/GiveItATriyView";
10-
import Spacer from "../../components/Spacer";
119

1210
const LandingPage: React.FC = () => {
1311
const windowSize = useWindowSize();

src/theme/Footer/index.tsx

+2-4
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ function Footer() {
6666
</FooterLogoContainer>
6767

6868
<FooterTagline>{siteConfig.tagline}</FooterTagline>
69-
<FooterGithubButton to={siteConfig.themeConfig.githubUrl} />
69+
<FooterGithubButton to={siteConfig.customFields.githubUrl} />
7070
</FooterLeft>
7171
<FooterRight>
7272
{links.map((linkItem, i) => (
@@ -87,9 +87,7 @@ function Footer() {
8787
</FooterRight>
8888
</ContentContainer>
8989
<FooterBottom>
90-
<FooterCopyrightText>
91-
{siteConfig.customFields.copyright}
92-
</FooterCopyrightText>
90+
<FooterCopyrightText>{copyright}</FooterCopyrightText>
9391
</FooterBottom>
9492
</FooterInner>
9593
</FooterContainer>

0 commit comments

Comments
 (0)