File tree Expand file tree Collapse file tree 2 files changed +13
-8
lines changed
Expand file tree Collapse file tree 2 files changed +13
-8
lines changed Original file line number Diff line number Diff line change 11<script lang =" ts" >
2- import { scroll_into_view } from ' $lib/client/utils'
32 import { faCheckCircle , faWarning } from ' @fortawesome/free-solid-svg-icons'
3+ import { tick } from ' svelte'
44 import Fa from ' svelte-fa'
55
66 let title = $state (' ' )
3434 error = ' Failed to fetch API'
3535 } finally {
3636 sending = false
37+ await tick ()
38+ section ?.scrollIntoView ({
39+ block: ' end' ,
40+ behavior: ' smooth' ,
41+ })
3742 }
3843 }
44+
45+ let section = $state <HTMLElement | null >(null )
3946 </script >
4047
41- <section >
48+ <section bind:this ={ section } >
4249 <h2 >Suggestion Form</h2 >
4350
4451 <p class =" hint" >
6774 </form >
6875
6976 {#if error }
70- <p class ="error" {@ attach scroll _into_view} >
77+ <p class =" error" >
7178 <Fa icon ={faWarning } />
7279 Error: {error }
7380 </p >
7481 {/if }
7582
7683 {#if url }
77- <p {@ attach scroll _into_view} >
84+ <p >
7885 <Fa icon ={faCheckCircle } />
7986 Your suggestion has been created as a
8087 <a href ={url } target =" _blank" >GitHub issue</a >. We will have a look at it!
8592<style >
8693 section {
8794 margin-top : 4rem ;
95+ padding-bottom : 1rem ;
96+ margin-bottom : -1rem ;
8897 }
8998
9099 .error {
Original file line number Diff line number Diff line change @@ -26,7 +26,3 @@ export function string_to_color(str: string): string {
2626 const h = hash % 360
2727 return `hsl(${ h } , 80%, 50%)`
2828}
29-
30- export const scroll_into_view : Attachment = ( element ) => {
31- element . scrollIntoView ( { block : 'end' , behavior : 'smooth' } )
32- }
You can’t perform that action at this time.
0 commit comments