Skip to content

Commit

Permalink
fix(Grid): cleaned up needless context
Browse files Browse the repository at this point in the history
  • Loading branch information
N00nDay committed Nov 20, 2022
1 parent 5eeb627 commit 1a31490
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 17 deletions.
9 changes: 1 addition & 8 deletions src/lib/components/grid/Col.svelte
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
<script lang="ts">
import { ROW_CONTEXT_ID } from './Row.svelte';
import { useContext } from '../../utils/useContext';
import { getContext } from 'svelte';
import { twMerge } from 'tailwind-merge';
import { get_current_component } from 'svelte/internal';
Expand All @@ -9,12 +7,7 @@
import { exclude } from '../../utils/exclude';
const forwardEvents = forwardEventsBuilder(get_current_component());
useContext({
context_id: ROW_CONTEXT_ID,
parent: 'Row',
component: 'Col'
});
const { padding }: { padding: string } = getContext(ROW_CONTEXT_ID);
const padding: string = getContext('padding');
const defaultClass = 'col';
$: finalClass = twMerge(defaultClass, $$props.class);
Expand Down
11 changes: 2 additions & 9 deletions src/lib/components/grid/Row.svelte
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
<script lang="ts" context="module">
<script lang="ts">
import { setContext } from 'svelte';
import { twMerge } from 'tailwind-merge';
export const ROW_CONTEXT_ID = 'row-context-id';
</script>

<script lang="ts">
import type TwSizes from '../../types/twSizes';
import { twSizes } from '../../utils/twSizes';
import { get_current_component } from 'svelte/internal';
Expand All @@ -32,9 +27,7 @@
padding = 'padding: 0;';
}
setContext(ROW_CONTEXT_ID, {
padding
});
setContext('padding', padding);
const defaultClass = 'relative mr-0 ml-0 block box-border';
$: finalClass = twMerge(defaultClass, $$props.class);
Expand Down

0 comments on commit 1a31490

Please sign in to comment.