File tree Expand file tree Collapse file tree 1 file changed +31
-0
lines changed
Expand file tree Collapse file tree 1 file changed +31
-0
lines changed Original file line number Diff line number Diff line change 1+ // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
2+ // SPDX-License-Identifier: Apache-2.0
3+
4+ import { useState } from "react" ;
5+
6+ import Header from "@cloudscape-design/components/header" ;
7+ import Input from "@cloudscape-design/components/input" ;
8+ import SpaceBetween from "@cloudscape-design/components/space-between" ;
9+
10+ import { Avatar } from "../../lib/components" ;
11+
12+ export default function AvatarImageAndWidth ( ) {
13+ const [ url , setURL ] = useState (
14+ "https://static1.colliderimages.com/wordpress/wp-content/uploads/2024/08/deadpool-wolverine-hugh-jackman-mask-reveal.jpg" ,
15+ ) ;
16+ const [ width , setWidth ] = useState ( "100" ) ;
17+
18+ return (
19+ < SpaceBetween direction = "vertical" size = "m" >
20+ < Header > Input an Image URL and custom size.</ Header >
21+
22+ < SpaceBetween direction = "horizontal" size = "m" >
23+ < Input onChange = { ( { detail } ) => setURL ( detail . value ) } value = { url } />
24+
25+ < Input onChange = { ( { detail } ) => setWidth ( detail . value ) } value = { width } inputMode = "numeric" type = "number" />
26+ </ SpaceBetween >
27+
28+ < Avatar ariaLabel = "An awesome picture of Wolverine" initials = "WV" imgUrl = { url } width = { Number ( width ) } />
29+ </ SpaceBetween >
30+ ) ;
31+ }
You can’t perform that action at this time.
0 commit comments