generateur_v3/frontend/src/components/exos/CreateCard.svelte

34 lines
755 B
Svelte
Raw Normal View History

2023-01-27 21:41:08 +01:00
<script lang="ts">
import type { Exercice, Page } from '../../types/exo.type';
import type { Writable } from 'svelte/store';
import EditForm from './EditForm.svelte';
export let cancel: Function;
export let exos: Writable<{ isLoading: boolean; isFetching: boolean; data: Page }>;
const updateExo = (e: Exercice) => {
exos.update((o) => {
return { ...o, data: { ...o.data, items: [e, ...o.data.items] } };
});
};
</script>
<div>
<h1>Nouvel exercice</h1>
<EditForm editing={false} {cancel} {updateExo} />
</div>
2023-02-22 12:43:39 +01:00
<style lang="scss">
@import '../../variables';
2023-01-27 21:41:08 +01:00
div {
2023-02-22 12:43:39 +01:00
background: $background;
2023-01-27 21:41:08 +01:00
padding: 50px;
display: flex;
flex-direction: column;
gap: 20px;
align-items: flex-start;
}
h1 {
font-size: 1.5em;
}
</style>