Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Styled Timeline #3

Merged
merged 7 commits into from
Nov 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified bun.lockb
Binary file not shown.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
},
"type": "module",
"dependencies": {
"@sveltejs/vite-plugin-svelte": "^4.0.0",
"svelte-kit": "^1.2.0"
}
}
10 changes: 10 additions & 0 deletions src/lib/components/Action.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@
let { action = $bindable(), deleteself }: { action: ActionData; deleteself: () => void } =
$props();

let actionBorderColor = $derived(
action.result === 'success' ? 'border-cresc_green' : 'border-fail_red'
);
let actionBackgroundColor = $derived(
action.result === 'success' ? 'bg-cresc_green' : 'bg-fail_red'
);
</script>

<!-- <button -->
<!-- class="{actionBorderColor} w-full p-1 rounded border-2 text-text_yellow" -->
<!-- onclick={deleteself} -->
<!-- > -->
<!-- {action.type} -->
<!-- </button> -->

<button
class="{actionBackgroundColor} w-full p-1 rounded border-2 border-outline_gray text-text_white"
onclick={deleteself}
Expand Down
13 changes: 8 additions & 5 deletions src/lib/components/Timeline.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,18 @@
import Action from './Action.svelte';

let { actions = $bindable() }: { actions: ActionData[] } = $props();
let latestActions: ActionData[] = $derived(actions.toReversed().slice(0, 5));
// let latestActions: ActionData[] = $derived(actions.toReversed().slice(0, 5));
</script>

<div class="flex flex-col items-center h-[80vh] bg-btn_grey text-text_white p-1 rounded gap-2 w-80">
{#each latestActions as _, i}
<h1 class="text-text_red">Timeline</h1>
<div
class="flex flex-col items-center h-full bg-btn_grey border-solid border-2 border-text_red p-2 rounded gap-2 w-full overflow-auto"
>
{#each actions as _, i}
<Action
bind:action={latestActions[i]}
bind:action={actions[i]}
deleteself={() => {
actions.splice(actions.indexOf(latestActions[i]), 1);
actions.splice(actions.indexOf(actions[i]), 1);
}}
/>
{/each}
Expand Down
2 changes: 2 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@
<style lang="postcss">
:global(body) {
@apply bg-bg_gray;
@apply font-mono;
touch-action: manipulation;
}
</style>
5 changes: 3 additions & 2 deletions src/routes/scout/+page.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
<Timeline bind:actions />

<!--to be changed in the future-->
<button class="bg-btn_grey w-80 p-1 rounded border-2 border-outline_gray" onclick={addAction}
>Add Action</button
<button
class="bg-btn_grey w-80 p-1 rounded border-2 border-text_red text-text_yellow"
onclick={addAction}>Add Action</button
>
</main>
13 changes: 7 additions & 6 deletions tailwind.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,16 @@ export default {
theme: {
colors: {
navbar_black: '#1c1c1c',
outline_gray: '#c2c2c2',
cresc_green: '#00d586',
bg_gray: '#2c2c2c',
outline_gray: '#ec4899',
cresc_green: '#49A078',
bg_gray: '#020617',
slack_purple: '#4A154B',
robot_blue: '#0083E6',
robot_red: '#ED1C24',
fail_red: '#EE3C42',
btn_grey: '#5C5C5C',
text_white: '#ffffff'
fail_red: '#FF6663',
btn_grey: '#0f172a',
text_red: '#FF4848',
text_yellow: '#F6B14B'
},
extend: {}
},
Expand Down