Skip to content

Commit

Permalink
fix: update filter group container to use 'rule' instead of 'filterGr…
Browse files Browse the repository at this point in the history
…oup'
  • Loading branch information
lawvs committed Aug 31, 2024
1 parent a62f62d commit 9badd88
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 8 deletions.
9 changes: 9 additions & 0 deletions .changeset/purple-impalas-move.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
"@fn-sphere/filter": minor
"@fn-sphere/theme-mui-material": patch
---

Breaking Changes

- Renamed `filterGroup` prop to `rule` in FilterGroupContainer.
- Modified `filterTheme` in theme-mui-material to use `rule` instead of `filterGroup`.
8 changes: 4 additions & 4 deletions packages/filter/src/views/filter-group-container.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import { useRootRule } from "../hooks/use-root-rule.js";
import { useView } from "../theme/hooks.js";

export type FilterGroupContainerProps = {
filterGroup: FilterGroup;
rule: FilterGroup;
children?: ReactNode;
};

export const FilterGroupContainer = ({
filterGroup,
rule,
children,
}: FilterGroupContainerProps) => {
const { getLocaleText } = useRootRule();
Expand All @@ -20,11 +20,11 @@ export const FilterGroupContainer = ({
appendChildRule,
appendChildGroup,
removeGroup,
} = useFilterGroup(filterGroup);
} = useFilterGroup(rule);
const { Button } = useView("components");

const text =
filterGroup.op === "or"
rule.op === "or"
? getLocaleText("operatorOr")
: getLocaleText("operatorAnd");

Expand Down
2 changes: 1 addition & 1 deletion packages/filter/src/views/filter-group.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export const FilterGroupView = ({ rule: filterGroup }: FilterGroupProps) => {
} = useView("templates");

return (
<FilterGroupContainer filterGroup={filterGroup}>
<FilterGroupContainer rule={filterGroup}>
{filterGroup.conditions.map((childRule, groupIdx) => {
return (
<Fragment key={childRule.id}>
Expand Down
6 changes: 3 additions & 3 deletions packages/theme-mui-material/src/theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,17 +114,17 @@ export const filterTheme = createFilterTheme({
},
},
templates: {
FilterGroupContainer: ({ filterGroup, children }) => {
FilterGroupContainer: ({ rule, children }) => {
const { getLocaleText } = useRootRule();
const {
ruleState: { isRoot, depth },
toggleGroupOp,
appendChildRule,
appendChildGroup,
} = useFilterGroup(filterGroup);
} = useFilterGroup(rule);

const text =
filterGroup.op === "or"
rule.op === "or"
? getLocaleText("operatorOr")
: getLocaleText("operatorAnd");

Expand Down

0 comments on commit 9badd88

Please sign in to comment.