<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Thashwini Wattuhewa on Medium]]></title>
        <description><![CDATA[Stories by Thashwini Wattuhewa on Medium]]></description>
        <link>https://medium.com/@thashwiniwattuhewa?source=rss-dd3a57a184ec------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*UP4QmYnZ8FJmrPplvzMAhg.jpeg</url>
            <title>Stories by Thashwini Wattuhewa on Medium</title>
            <link>https://medium.com/@thashwiniwattuhewa?source=rss-dd3a57a184ec------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Wed, 18 Nov 2026 20:13:04 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@thashwiniwattuhewa/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Thoughts]]></title>
            <link>https://medium.com/@thashwiniwattuhewa/thoughts-2ad950010178?source=rss-dd3a57a184ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/2ad950010178</guid>
            <category><![CDATA[happiness]]></category>
            <category><![CDATA[love]]></category>
            <category><![CDATA[care]]></category>
            <category><![CDATA[life]]></category>
            <category><![CDATA[family]]></category>
            <dc:creator><![CDATA[Thashwini Wattuhewa]]></dc:creator>
            <pubDate>Mon, 18 Mar 2024 14:34:51 GMT</pubDate>
            <atom:updated>2024-03-18T14:35:16.197Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/509/1*M1KtUR3hhrQHUSiPCZPIzA.jpeg" /></figure><p>This is my first non-technical blog. I simply want to share some of my thoughts and reflections, as well as insights I’ve gathered from others that resonate with me. I hope this will be helpful to someone who feels similarly. I hope writing this will also help me to feel good.</p><p>As I know, I am a person with a lot of love inside me, and I can love people deeply. There are days when I feel that the love I give to others isn’t reciprocated, which truly saddens me. However, at the same time, I know that they do love me.</p><p>In our lives, we love ourselves, our family, friends, colleagues, relations, and animals. In this world, you have met a lot of people so far, and there are a lot of people you love, people who are close to your heart. Sometimes, we don’t get that love and care back in the same way we gave it to them; does that make you sad? Yeah, I agree it can be disheartening. But don’t think they don’t love you; they do love you, but it’s not in the same way you love them. However, they do love you back, perhaps just as much as you do. The difference is they express it in a different way. Remember the moments you enjoyed with them, recall the good laughs you had with them, remember how they made you happy. So, do not get upset. All people are not the same, and they have different contexts, so don’t get upset and don’t stop loving them. Just love them the same way you do, love a lot as you used to do because it’s really good if we can give another person so much love and care. So don’t stop, but don’t expect the same love and care back in the same way; just love the people close to your heart.</p><p>There are two things I have heard from my colleagues that I’d like to share. The first is, “Don’t ever get upset if you haven’t done anything wrong to anyone.” The second one is, “If you feel down, just remember what you have achieved so far, how capable you are, and focus more on your career.”</p><p>Also, if you feel upset, don’t think you don’t have anyone to talk to. I’m sure if you think carefully, there is someone who will listen. It could be your family, it could be your friend, it could be your colleague, it could be your pet, it could be your relative, or it could even be yourself. You can write, you can dance, you can sing… there is something or someone that can make you happy.</p><p>If you have done something wrong and you really want to make it right, don’t worry, you definitely can correct it. Think in a fresh way and make yourself happy. Have courage, love yourself. If you look carefully, you have a lot of people around you who like to help you. Even if you can’t see anyone to help you, don’t be upset; you have yourself. Believe in yourself and make yourself happy.</p><p>There is a quote saying “You are responsible for your own happiness.” I think that is true. Our happiness depends on the way we think. Stop worrying. If we can make ourselves kind, we can stay happy, I think.</p><p>Stay Happy! Stay Kind!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2ad950010178" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generic React Table Component]]></title>
            <link>https://medium.com/@thashwiniwattuhewa/generic-react-table-component-1407a6fc2179?source=rss-dd3a57a184ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/1407a6fc2179</guid>
            <category><![CDATA[daisyui]]></category>
            <category><![CDATA[tailwind-css]]></category>
            <category><![CDATA[generic-component]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[react]]></category>
            <dc:creator><![CDATA[Thashwini Wattuhewa]]></dc:creator>
            <pubDate>Mon, 21 Aug 2023 18:01:20 GMT</pubDate>
            <atom:updated>2023-08-21T18:08:37.556Z</atom:updated>
            <content:encoded><![CDATA[<p>Using TailwindCSS, daisyUI, and Typescript</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/1*7tvE8h80jEQkh3v9l9cJAg.jpeg" /></figure><h4><strong>Introduction</strong></h4><p>This is a generic table component that you can customize your columns, and styles and also use typescript generics</p><h4><strong>Create react project</strong></h4><pre>npm create vite@latest</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/360/1*EoVn77nyop7k4HVBqjx8jg.png" /></figure><pre>// tailwind.config.js<br><br>/** @type {import(&#39;tailwindcss&#39;).Config} */<br>export default {<br>  content: [&#39;./src/**/*.{js,ts,jsx,tsx}&#39;],<br>  theme: {<br>    extend: {},<br>  },<br>  plugins: [require(&#39;daisyui&#39;)],<br>};</pre><h4><strong>Create the custom table component</strong></h4><pre>// src/Types/ColumnProps.ts<br><br>import { ReactElement } from &#39;react&#39;;<br><br>export interface ColumnProps&lt;T&gt; {<br>  key: string;<br>  title: string | ReactElement;<br>  render?: (column: ColumnProps&lt;T&gt;, item: T) =&gt; ReactElement;<br>}</pre><p>This <strong>key</strong> property refers to a key of a data object, and we use this key to get column values. This <strong>title </strong>refers to the title of the columns. This <strong>render()</strong> can use when you want o customize your column value. This method is optional. If you provide render() column values will take from it otherwise it will take from the key of the data object.</p><pre>//src/components/Table/Table.tsx<br><br>import { ColumnProps } from &#39;../../Types/ColumnProps&#39;;<br><br>type Props&lt;T&gt; = {<br>  columns: Array&lt;ColumnProps&lt;T&gt;&gt;;<br>  data?: T[];<br>};<br><br>const Table = &lt;T,&gt;({ data, columns }: Props&lt;T&gt;) =&gt; {<br>  const headers = columns.map((column, index) =&gt; {<br>    return (<br>      &lt;th key={`headCell-${index}`} className=&quot;!z-0&quot;&gt;<br>        {column.title}<br>      &lt;/th&gt;<br>    );<br>  });<br><br>  const rows = !data?.length ? (<br>    &lt;tr&gt;<br>      &lt;td colSpan={columns.length} className=&quot;text-center&quot;&gt;<br>        No data<br>      &lt;/td&gt;<br>    &lt;/tr&gt;<br>  ) : (<br>    data?.map((row, index) =&gt; {<br>      return (<br>        &lt;tr key={`row-${index}`}&gt;<br>          {columns.map((column, index2) =&gt; {<br>            const value = column.render<br>              ? column.render(column, row as T)<br>              : (row[column.key as keyof typeof row] as string);<br><br>            return &lt;td key={`cell-${index2}`}&gt;{value}&lt;/td&gt;;<br>          })}<br>        &lt;/tr&gt;<br>      );<br>    })<br>  );<br><br>  return (<br>    &lt;div className=&quot;overflow-x-auto&quot;&gt;<br>      &lt;table className=&quot;table w-full&quot;&gt;<br>        &lt;thead className=&quot;bg-slate-400 text-black&quot;&gt;<br>          &lt;tr&gt;{headers}&lt;/tr&gt;<br>        &lt;/thead&gt;<br><br>        &lt;tbody&gt;{rows}&lt;/tbody&gt;<br>      &lt;/table&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default Table;</pre><p>In the above table component, only two props are needed, columns and data. The header function creates the column headers and the row function creates the table records. Here we are using typescript generics so this table component suit for any type of data.</p><pre>// src/App.tsx<br><br>import { ColumnProps } from &#39;./Types/ColumnProps&#39;;<br>import Table from &#39;./components/Table/Table&#39;;<br><br>type Data = {<br>  name: string;<br>  job: string;<br>  location: string;<br>};<br><br>function App() {<br>  const data = [<br>    {<br>      name: &#39;Cy Ganderton&#39;,<br>      job: &#39;Quality Control Specialist&#39;,<br>      location: &#39;Canada&#39;,<br>    },<br>    {<br>      name: &#39;Hart Hagerty&#39;,<br>      job: &#39;Desktop Support Technician&#39;,<br>      location: &#39;United States&#39;,<br>    },<br>    {<br>      name: &#39;Brice Swyre&#39;,<br>      job: &#39;Tax Accountant&#39;,<br>      location: &#39;China&#39;,<br>    },<br>  ];<br>  const columns: Array&lt;ColumnProps&lt;Data&gt;&gt; = [<br>    {<br>      key: &#39;name&#39;,<br>      title: &#39;Name&#39;,<br>    },<br>    {<br>      key: &#39;job&#39;,<br>      title: &#39;Job&#39;,<br>    },<br>    {<br>      key: &#39;location&#39;,<br>      title: &#39;Color&#39;,<br><br>      render: (_, record) =&gt; {<br>        return &lt;div className=&quot;text-blue-500 font-bold&quot;&gt;{record.location}&lt;/div&gt;;<br>      },<br>    },<br>  ];<br><br>  return (<br>    &lt;&gt;<br>      &lt;div&gt;<br>        &lt;Table data={data} columns={columns} /&gt;<br>      &lt;/div&gt;<br>    &lt;/&gt;<br>  );<br>}<br><br>export default App;</pre><p>Here I have called my custom table component by passing columns and data. There you can customize your columns as you want and give the type of the data object then pass it to the table component.</p><h4>Conclusion</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/865/1*fsPVskH903YDTsdnzxum6A.png" /><figcaption>Custom Table Component</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1407a6fc2179" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Image Customise with React-Konva — Part III]]></title>
            <link>https://medium.com/@thashwiniwattuhewa/image-customise-with-react-konva-part-iii-a167143fd9cc?source=rss-dd3a57a184ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/a167143fd9cc</guid>
            <dc:creator><![CDATA[Thashwini Wattuhewa]]></dc:creator>
            <pubDate>Sat, 25 Mar 2023 08:01:25 GMT</pubDate>
            <atom:updated>2023-03-25T08:01:25.682Z</atom:updated>
            <content:encoded><![CDATA[<h3>Image Customise with React-Konva — Part III</h3><h3>Part III — How to add text to t-shirt and rotate text</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zYzdG6BhO4xudu-rZHUzQg.gif" /></figure><p>Install useImage React Hook</p><pre>npm i use-image</pre><pre>//Custmize.js file<br><br>import React, { useEffect, useState } from &#39;react&#39;;<br>import { Grid, Box } from &#39;@material-ui/core&#39;;<br>import useStyles from &#39;./CustomizeStyle&#39;;<br>import { CirclePicker } from &#39;react-color&#39;;<br>import Tshirt from &#39;./Components/Tshirt&#39;;<br>import DesignNav from &#39;./Components/DesignNav&#39;;<br>import TextAddOn from &#39;./Components/TextAddOn&#39;;<br>import { Stage, Layer } from &#39;react-konva&#39;;<br>import TextLayer from &#39;./Components/TextLayer&#39;;<br><br>const Customize = () =&gt; {<br>  const classes = useStyles();<br>  const [textLayerColors, setTextLayerColors] = useState([<br>    &#39;#ffffff&#39;,<br>    &#39;#000000&#39;,<br>    &#39;#f44336&#39;,<br>    &#39;#e91e63&#39;,<br>    &#39;#9c27b0&#39;,<br>    &#39;#673ab7&#39;,<br>    &#39;#3f51b5&#39;,<br>    &#39;#2196f3&#39;,<br>    &#39;#03a9f4&#39;,<br>    &#39;#00bcd4&#39;,<br>    &#39;#009688&#39;,<br>    &#39;#4caf50&#39;,<br>    &#39;#8bc34a&#39;,<br>    &#39;#cddc39&#39;,<br>    &#39;#ffeb3b&#39;,<br>    &#39;#ffc107&#39;,<br>    &#39;#ff9800&#39;,<br>    &#39;#ff5722&#39;,<br>    &#39;#795548&#39;,<br>    &#39;#607d8b&#39;,<br>    &#39;#C0C0C0&#39;,<br>    &#39;#C9AE5D&#39;,<br>  ]);<br>  const [color, setColor] = useState([&#39;#ffffff&#39;]);<br>  const [toggleState, setToggleState] = useState(1);<br>  const [newText, setNewText] = useState(&#39;&#39;);<br>  const [index, setIndex] = useState(0);<br>  const [pickerColorArray, setPickerColorArray] = useState([]);<br>  const [textColor, setTextColor] = useState(&#39;&#39;);<br>  const stageRef = React.useRef(null);<br>  const [selectedId, selectShape] = useState(null);<br><br>  const toggleTab = (index) =&gt; {<br>    setToggleState(index);<br>  };<br><br>  const changeText = (e) =&gt; {<br>    setNewText(e.target.value);<br>  };<br><br>  const addText = () =&gt; {<br>    const newIndex = index + 1;<br>    setIndex(newIndex);<br>    setPickerColorArray([...pickerColorArray, newText]);<br>  };<br><br>  //When user clicks on logo or text, it will show the transformer<br>  const handleStageMouseDown = (e) =&gt; {<br>    if (e.target === e.target.getStage()) {<br>      selectShape(null);<br>      return;<br>    }<br>    const clickedOnTransformer =<br>      e.target.getParent().className === &#39;Transformer&#39;;<br>    if (clickedOnTransformer) {<br>      return;<br>    }<br><br>    const name = e.target.name();<br>    if (name) {<br>      selectShape(name);<br>    } else {<br>      selectShape(null);<br>    }<br>  };<br><br>  useEffect(() =&gt; {<br>    console.log(&#39;toggleState&#39;, toggleState);<br>  }, [toggleState]);<br><br>  return (<br>    &lt;Grid container&gt;<br>      &lt;Grid item xs={4}&gt;<br>        &lt;Grid item xl={2} className={classes.barContainer}&gt;<br>          &lt;DesignNav toggleState={toggleState} toggleTab={toggleTab} /&gt;<br>          &lt;div&gt;<br>            &lt;Box<br>              className={<br>                toggleState === 1 ? classes.activeBarBox : classes.barBox<br>              }&gt;<br>              &lt;div className=&quot;textContainer&quot;&gt;<br>                &lt;TextAddOn changeText={changeText} addText={addText} /&gt;<br>                &lt;CirclePicker<br>                  border=&quot;black&quot;<br>                  borderColor=&quot;black&quot;<br>                  stroke=&quot;black&quot;<br>                  width=&quot;max-width&quot;<br>                  colors={textLayerColors}<br>                  onChange={(textLColors) =&gt; {<br>                    setTextColor(textLColors.hex);<br>                  }}<br>                /&gt;<br>              &lt;/div&gt;<br>            &lt;/Box&gt;<br>            &lt;Box<br>              className={<br>                toggleState === 2 ? classes.activeBarBox : classes.barBox<br>              }&gt;<br>              &lt;Grid container&gt;<br>                &lt;div className=&quot;color-picker&quot;&gt;<br>                  &lt;CirclePicker<br>                    id=&quot;circle-picker&quot;<br>                    display=&quot;flex&quot;<br>                    circleSize={35}<br>                    colors={textLayerColors}<br>                    onChange={(color) =&gt; {<br>                      setColor(color.rgb);<br>                    }}<br>                  /&gt;<br>                &lt;/div&gt;<br>              &lt;/Grid&gt;<br>            &lt;/Box&gt;<br>          &lt;/div&gt;<br>        &lt;/Grid&gt;<br>        &lt;Grid item xs={9}&gt;&lt;/Grid&gt;<br>      &lt;/Grid&gt;<br>      &lt;Grid item xs={6}&gt;<br>        &lt;Stage<br>          width={850}<br>          height={500}<br>          onMouseDown={handleStageMouseDown}<br>          ref={stageRef}&gt;<br>          &lt;Layer&gt;<br>            &lt;Tshirt color={color} /&gt;<br>          &lt;/Layer&gt;<br>          &lt;Layer&gt;<br>            {pickerColorArray.map((value, index) =&gt; {<br>              return (<br>                &lt;TextLayer<br>                  value={value}<br>                  textColor={textColor}<br>                  key={index}<br>                  isSelected={index === selectedId}<br>                  shapeProps={value}<br>                  onSelect={() =&gt; {<br>                    selectShape(index);<br>                  }}<br>                  onChange={(newAttrs) =&gt; {<br>                    const rects = pickerColorArray.slice();<br>                    rects[index] = newAttrs;<br>                  }}<br>                  onDelete={() =&gt; {<br>                    const newString = [...pickerColorArray];<br>                    newString.splice(index, 1);<br>                    setPickerColorArray(newString);<br>                  }}<br>                /&gt;<br>              );<br>            })}<br>          &lt;/Layer&gt;<br>        &lt;/Stage&gt;<br>      &lt;/Grid&gt;<br>      &lt;Grid item xs={2}&gt;&lt;/Grid&gt;<br>    &lt;/Grid&gt;<br>  );<br>};<br>export default Customize;</pre><p>Here we have added a component called <strong>TextAddOn to </strong>add text and a color picker to change the text color. let’s look into the <strong>TextAddOn </strong>component</p><pre>// TextAddOn.js<br><br>import React from &#39;react&#39;;<br>import { Button, TextField } from &#39;@material-ui/core&#39;;<br>import useStyles from &#39;../CustomizeStyle&#39;;<br><br>const TextAddOn = (props) =&gt; {<br>  const classes = useStyles();<br><br>  return (<br>    &lt;div className={classes.textAddonContainer}&gt;<br>      &lt;div&gt;<br>        &lt;form&gt;<br>          &lt;TextField<br>            autoFocus<br>            margin=&quot;dense&quot;<br>            label=&quot;Add your custom text here&quot;<br>            type=&quot;text&quot;<br>            fullWidth<br>            onChange={props.changeText}<br>          /&gt;<br>          &lt;Button<br>            style={{ background: &#39;black&#39;, color: &#39;white&#39;, float: &#39;right&#39; }}<br>            onClick={props.addText}&gt;<br>            ADD<br>          &lt;/Button&gt;<br>        &lt;/form&gt;<br>      &lt;/div&gt;<br>    &lt;/div&gt;<br>  );<br>};<br><br>export default TextAddOn;</pre><p>I have added another <strong>Layer </strong>for the text. Let’s have a look at the <strong>TextLayer </strong>component.</p><pre>// TextLayer.js<br><br>import React, { useState, useEffect } from &#39;react&#39;;<br>import { Text, Transformer, Group, Image } from &#39;react-konva&#39;;<br>import useImage from &#39;use-image&#39;;<br>import cancel from &#39;../Images/close.svg&#39;;<br><br>const TextLayer = (props) =&gt; {<br>  const textRef = React.useRef(null);<br>  const trRef = React.useRef();<br>  const [deleteImage] = useImage(cancel);<br>  const [showDeleteButton, setShowDeleteButton] = useState(false);<br>  const [isShown, setIsShown] = useState(false);<br><br>  useEffect(() =&gt; {<br>    if (props.isSelected) {<br>      trRef.current.nodes([textRef.current]);<br>      trRef.current.getLayer().batchDraw();<br>    }<br>  }, [props.isSelected]);<br><br>  useEffect(() =&gt; {<br>    if (isShown) {<br>      setShowDeleteButton(true);<br>    } else {<br>      setTimeout(() =&gt; {<br>        setShowDeleteButton(false);<br>      }, 4000);<br>    }<br>  }, [isShown]);<br><br>  return (<br>    &lt;React.Fragment&gt;<br>      &lt;Group draggable&gt;<br>        {showDeleteButton &amp;&amp; (<br>          &lt;Image<br>            onClick={props.onDelete}<br>            image={deleteImage}<br>            width={10}<br>            height={10}<br>            offset={{<br>              x: -160,<br>              y: -135,<br>            }}<br>          /&gt;<br>        )}<br><br>        &lt;Text<br>          name=&quot;text&quot;<br>          offset={{<br>            x: -150,<br>            y: -150,<br>          }}<br>          wrap=&quot;char&quot;<br>          align=&quot;center&quot;<br>          fill={props.textColor}<br>          fontSize={20}<br>          fontFamily=&quot;Calibri&quot;<br>          opacity={1}<br>          draggable={false}<br>          text={props.value}<br>          ref={textRef}<br>          onClick={props.onSelect}<br>          onTap={props.onSelect}<br>          onDragEnd={(e) =&gt; {<br>            const shape = e.target;<br>            props.onChange({<br>              x: shape.x(),<br>              y: shape.y(),<br>              width: shape.width() * shape.scaleX(),<br>              height: shape.height() * shape.scaleY(),<br>              rotation: shape.rotation(),<br>            });<br>          }}<br>          onTransformEnd={(e) =&gt; {<br>            // transformer is changing scale of the node<br>            // and NOT its width or height<br>            // but in the store we have only width and height<br>            // to match the data better we will reset scale on transform end<br>            const node = textRef.current.getStage();<br>            const scaleX = node.scaleX();<br>            const scaleY = node.scaleY();<br><br>            // we will reset it back<br>            node.scaleX(1);<br>            node.scaleY(1);<br>            props.onChange({<br>              // ...shapeProps,<br>              x: node.x(),<br>              y: node.y(),<br>              // set minimal value<br>              width: Math.max(5, node.width() * scaleX),<br>              height: Math.max(node.height() * scaleY),<br>            });<br>          }}<br>          onMouseEnter={() =&gt; setIsShown(true)}<br>          onMouseLeave={() =&gt; setIsShown(false)}<br>        /&gt;<br><br>        {props.isSelected &amp;&amp; (<br>          &lt;Transformer<br>            ref={trRef}<br>            boundBoxFunc={(oldBox, newBox) =&gt; {<br>              //limit resize<br>              if (newBox.width &lt; 5 || newBox.height &lt; 5) {<br>                return oldBox;<br>              }<br>              return newBox;<br>            }}<br>          /&gt;<br>        )}<br>      &lt;/Group&gt;<br>    &lt;/React.Fragment&gt;<br>  );<br>};<br><br>export default TextLayer;</pre><p>Apart from the above code changes some changes in the style file</p><pre>// CustomizeStyle.js<br><br>import { makeStyles } from &#39;@material-ui/core&#39;;<br><br>const useStyles = makeStyles((theme) =&gt; ({<br>  tabs: {<br>    alignItems: &#39;center&#39;,<br>    background: &#39;white&#39;,<br>    width: &#39;74px&#39;,<br>    justifyContent: &#39;center&#39;,<br>  },<br>  activeTabs: {<br>    background: &#39;white&#39;,<br>    width: &#39;74px&#39;,<br>  },<br>  barFont: {<br>    fontSize: &#39;10px&#39;,<br>  },<br>  activeContent: {<br>    display: &#39;block&#39;,<br>  },<br>  barContainer: {<br>    display: &#39;flex&#39;,<br>    height: &#39;308px&#39;,<br>    width: &#39;300px&#39;,<br>    marginLeft: &#39;20px&#39;,<br>  },<br>  activeBarBox: {<br>    background: &#39;#e5f3f8&#39;,<br>    padding: &#39;10px&#39;,<br>    justifyContent: &#39;space-between&#39;,<br>    alignItems: &#39;center&#39;,<br>    height: &#39;268px&#39;,<br>    margin: &#39;20px 0px&#39;,<br>    display: &#39;block&#39;,<br>    width: &#39;320px&#39;,<br>  },<br>  barBox: {<br>    background: &#39;#e5f3f8&#39;,<br>    padding: &#39;10px&#39;,<br>    justifyContent: &#39;space-between&#39;,<br>    alignItems: &#39;center&#39;,<br>    height: &#39;268px&#39;,<br>    margin: &#39;20px 0px&#39;,<br>    display: &#39;none&#39;,<br>    width: &#39;320px&#39;,<br>  },<br>  bar: {<br>    background: &#39;black&#39;,<br>    padding: &#39;4px&#39;,<br>    marginLeft: &#39;5px&#39;,<br>    justifyContent: &#39;space-between&#39;,<br>    marginTop: &#39;20px&#39;,<br>  },<br>  textContainer: {<br>    width: &#39;320px&#39;,<br>  },<br>  textAddonContainer: {<br>    marginBottom: &#39;10px&#39;,<br>    height: &#39;98px&#39;,<br>  },<br>}));<br><br>export default useStyles;</pre><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a167143fd9cc" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Image Customise with React-Konva — Part II]]></title>
            <link>https://medium.com/@thashwiniwattuhewa/image-customise-with-react-konva-part-ii-6e97a3343508?source=rss-dd3a57a184ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/6e97a3343508</guid>
            <dc:creator><![CDATA[Thashwini Wattuhewa]]></dc:creator>
            <pubDate>Fri, 27 May 2022 04:48:25 GMT</pubDate>
            <atom:updated>2022-05-27T05:06:49.923Z</atom:updated>
            <content:encoded><![CDATA[<h3>Image Customise with React-Konva — Part II</h3><h3>Part II How to change color of the t-shirt</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*l9eXC8oDF4lTOW59PKGS5w.gif" /></figure><p>Here onwards i use Material-UI framework</p><pre>npm i @material-ui/core</pre><p>Here we use React Color library. It includes 13 Different Pickers such as<strong> </strong>Sketch, Photoshop, Chrome and many more</p><pre>npm i react-color</pre><pre>//Custmize.js file<br>import React, { useState } from ‘react’;<br>import { Grid, Box } from ‘@material-ui/core’;<br>import useStyles from ‘./CustomizeStyle’;<br>import { CirclePicker } from ‘react-color’;<br>import Tshirt from ‘./Components/Tshirt’;<br>import DesignNav from ‘./Components/DesignNav’;</pre><pre>const Customize = () =&gt; {</pre><pre>const classes = useStyles();<br>const [textLayerColors, setTextLayerColors] = useState([<br>‘#ffffff’,<br>‘#000000’,<br>‘#f44336’,<br>‘#e91e63’,<br>‘#9c27b0’,<br>‘#673ab7’,<br>‘#3f51b5’,<br>‘#2196f3’,<br>‘#03a9f4’,<br>‘#00bcd4’,<br>‘#009688’,<br>‘#4caf50’,<br>‘#8bc34a’,<br>‘#cddc39’,<br>‘#ffeb3b’,<br>‘#ffc107’,<br>‘#ff9800’,<br>‘#ff5722’,<br>‘#795548’,<br>‘#607d8b’,<br>‘#C0C0C0’,<br>‘#C9AE5D’,<br>]);<br>const [color, setColor] = useState([‘#ffffff’]);</pre><pre>return (<br>&lt;Grid container&gt;<br> &lt;Grid item xs={4}&gt;<br>  &lt;Grid item xs={3} className={classes.barContainer}&gt;<br>   &lt;DesignNav /&gt;<br>   &lt;Box className={classes.barBox}&gt;<br>    &lt;Grid Container&gt;<br>     &lt;div className=”color-picker”&gt;<br>     &lt;CirclePicker<br>     id=”circle-picker”<br>     display=”flex”<br>     circleSize={35}<br>     colors={textLayerColors}<br>     onChange={(color) =&gt; {<br>     setColor(color.rgb);<br>     console.log(color);<br>     }}<br>     /&gt;<br>     &lt;/div&gt;<br>    &lt;/Grid&gt;<br>   &lt;/Box&gt;<br>  &lt;/Grid&gt;<br>  &lt;Grid item xs={9}&gt;&lt;/Grid&gt;<br> &lt;/Grid&gt;<br> &lt;Grid item xs={6}&gt;<br>  &lt;Tshirt color={color} /&gt;<br> &lt;/Grid&gt;<br>);<br>};</pre><pre>export default Customize;</pre><p>Lets have a look at the Tshirt Component</p><pre>import React, { useState, useEffect } from ‘react’;<br>import { Stage, Layer, Image } from ‘react-konva’;<br>import BackgroundImage from ‘../Images/tshirtMockup.png’;<br>import Konva from ‘konva’;</pre><pre>function Tshirt(props) {</pre><pre>const [images, setImage] = useState(new window.Image());<br>const shirtRef = React.useRef();</pre><pre>useEffect(() =&gt; {<br>const MyImage = new window.Image();<br>MyImage.src = BackgroundImage;<br>MyImage.onload = () =&gt; {<br>setImage(MyImage);<br>};<br>}, []);</pre><pre>useEffect(() =&gt; {<br>if (!shirtRef.current) {<br>// do componentDidMount logic<br>shirtRef.current = true;<br>} else {<br>// do componentDidUpdate logic<br>shirtRef.current.cache();<br>shirtRef.current.getLayer().batchDraw();<br>shirtRef.current.blue(props.color.b);<br>shirtRef.current.red(props.color.r);<br>shirtRef.current.green(props.color.g);<br>}<br>});</pre><pre>return (<br>&lt;Stage width={850} height={500}&gt;<br> &lt;Layer&gt;<br>  &lt;Image<br>  filters={[Konva.Filters.RGB]}<br>  image={images}<br>  x={0}<br>  y={0}<br>  width={850}<br>  height={500}<br>  ref={shirtRef}<br>  /&gt;<br> &lt;/Layer&gt;<br>&lt;/Stage&gt;<br>);<br>}</pre><pre>export default Tshirt;</pre><p>A use of a useRef() hook is to access DOM elements. This is performed in 3 steps:</p><ol><li>Define the reference to access the element const shirtRef = React.useRef();</li><li>Assign the reference to ref attribute of the element: &lt;Image ref={shirtRef}/&gt;;</li><li>After mounting, shirtRef.current points to the DOM element.</li></ol><p>shirtRef.current.focus; : Focus on the input field when the component mounts<br>imageRef.current.cache(); : Cache the original image, and imageRef.current.getLayer().batchDraw(); : Redraws the image with the filter applied.</p><p>Then have a look at DesignNav Component</p><pre>import React from ‘react’;<br>import { Box, Grid, Typography } from ‘@material-ui/core’;<br>import addColor from ‘../Images/drop.svg’;<br>import useStyles from ‘../CustomizeStyle’;</pre><pre>function DesignNav() {</pre><pre>const classes = useStyles();</pre><pre>return (<br>&lt;Grid className={classes.bar}&gt;<br> &lt;Grid&gt;<br>  &lt;Box className={classes.tabs}&gt;<br>   &lt;a&gt;<br>    &lt;button className={classes.activeTabs}&gt;<br>     &lt;img height={50} src={addColor} /&gt;<br>     &lt;Typography textDecoration=”none” className={classes.barFont}&gt;<br>      COLOR<br>     &lt;/Typography&gt;<br>    &lt;/button&gt;<br>   &lt;/a&gt;<br>  &lt;/Box&gt;<br> &lt;/Grid&gt;<br>&lt;/Grid&gt;<br>);<br>}</pre><pre>export default DesignNav;</pre><p>Add style file</p><p>import { makeStyles } from ‘@material-ui/core’;</p><p>const useStyles = makeStyles((theme) =&gt; ({</p><pre>//CustomizeStyles.js</pre><pre>tabs: {<br>alignItems: ‘center’,<br>background: ‘white’,<br>width: ‘74px’,<br>justifyContent: ‘center’,<br>},</pre><pre>activeTabs: {<br>background: ‘white’,<br>width: ‘74px’,<br>},</pre><pre>barFont: {<br>fontSize: ‘10px’,<br>},</pre><pre>activeContent: {<br>display: ‘block’,<br>},</pre><pre>barContainer: {<br>display: ‘flex’,<br>height: ‘308px’,<br>width: ‘300px’,<br>marginLeft: ‘20px’,<br>},</pre><pre>barBox: {<br>background: ‘#e5f3f8’,<br>padding: ‘10px’,<br>justifyContent: ‘space-between’,<br>alignItems: ‘center’,<br>height: ‘268px’,<br>margin: ‘20px 0px’,<br>},</pre><pre>bar: {<br>background: ‘black’,<br>padding: ‘4px’,<br>marginLeft: ‘5px’,<br>justifyContent: ‘space-between’,<br>marginTop: ‘20px’,<br>},</pre><pre>}));</pre><pre>export default useStyles;</pre><p>Here we have come to the end of Second tutorial of “How to change the color of the t-shirt” let’s meet with our Third tutorial “How to change the type of the t-shirt” soon. Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6e97a3343508" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[My internship experience as a Software Engineer Intern at 99x]]></title>
            <link>https://medium.com/@thashwiniwattuhewa/my-internship-experience-as-a-software-engineer-intern-at-99x-381c303d98d3?source=rss-dd3a57a184ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/381c303d98d3</guid>
            <dc:creator><![CDATA[Thashwini Wattuhewa]]></dc:creator>
            <pubDate>Thu, 10 Mar 2022 12:57:07 GMT</pubDate>
            <atom:updated>2022-03-11T01:13:37.111Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*bLIA591eclw8QbC_O0gTaQ.gif" /></figure><p>99x was always in my dream job list. I never thought it would become a reality this soon. I was so excited when I got to know that I was selected for the internship interview at 99X. And it was my first internship interview.</p><p>I already started loving the company due to the well organized interview process. Also the interviewers were very pleasant and professional. When I got my feedback on the very next day I was shocked about the quickness in the management decision making. One thing I love to learn in my career life.</p><p>I joined 99x on 13th October 2021 as a Software engineer intern and I had a warm welcome even though It was a virtual event. It was very well conducted and the company assigned a buddy for each one of the interns. It was a really good thing, since we are new to the team and to the company it’s always better that we have someone to talk and communicate our all concerns related to job matters. And the opportunity we got to engage in a discussion with a senior member of 99x who has over 20 years of experience at 99x help us in many ways to develop our talents and to be smart in our career development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fFXe3md5y3ex7KHBSt03rg.jpeg" /></figure><p>The things I have gained so far are priceless. Not only the technical skills but also the people I got to know and the things I learnt from each individual I met.</p><p>The first month was spent learning about the project tech stack. And then I got transferred to another project. It’s a React project. Actually, that is the area I’m most interested in. So it was a great opportunity for me to grab.</p><p>The first few days I had Knowledge transfer sessions by my lead and those were very informative and valuable. Being a part of this project I got a chance to be familiar with new technologies like AWS services and graphQL.</p><p>At the beginning it wasn’t easy for me to work with these new techs but the knowledge transition sessions conducted by senior team members helps me to understand those new concepts deeply. Also I got a chance to directly communicate with the client and demonstrate the feature I have implemented in the sprint review. Those were great experiences and opportunities for me since this is my first internship program.</p><p>In the internship program we have been assigned to a mentor and we have Bi-Weekly meetings to discuss our strengths, weaknesses and concerns to develop our performance and career experience. Since I’m planning to continue my career as a front end developer my mentor provided me with an opportunity and scheduled a meeting with a front end expert at 99x.</p><p>It was a very interesting session and I had and gained good understanding on how to make future plans and what are the qualifications I should gain to go forward in my career path. Also this program encouraged me to start blogging.</p><p>As I see the main thing that 99x is special from other companies is the culture at 99x. Every person that I have met from the very first day is pleasant, friendly, flexible and supportive. So far I spent most of the time with my teammates even though we haven’t met. They are very supportive and friendly. They appreciate other teammates when they achieve something and support them. To me they are like a family who look forward to achieve success in many ways.</p><p>So far my journey at 99x is amazing and I am happy about the progress I have made. Excited to explore the rest of my internship journey at 99x and to be a part of this family.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=381c303d98d3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Image Customise with React-Konva]]></title>
            <link>https://medium.com/@thashwiniwattuhewa/image-customise-with-react-konva-71d5b3e684e7?source=rss-dd3a57a184ec------2</link>
            <guid isPermaLink="false">https://medium.com/p/71d5b3e684e7</guid>
            <dc:creator><![CDATA[Thashwini Wattuhewa]]></dc:creator>
            <pubDate>Mon, 07 Feb 2022 13:05:21 GMT</pubDate>
            <atom:updated>2022-05-26T11:21:25.705Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_b-mSlYB8pjGkIk_RVpMUg.gif" /></figure><p>Lets build this t-shirt customising React App step by step. At the end of this tutorial series you will be able to create this t-shirt customising React App.</p><p><strong>Part 1 </strong>React-Konva basics and adding a konva image</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/431/1*EXFiIThHS87p27dji3wlXg.jpeg" /></figure><p><a href="https://konvajs.org/docs/react/index.html">React-Konva</a> is a JavaScript library for manipulating complex canvas using <a href="https://reactjs.org/">React</a></p><p>We can install it by running</p><pre>npm i konva</pre><p>In the first tutorial lets go through the react-konva basics. First i’m going to talk about two react-konva components which are <strong>Stage</strong> and <strong>Layers. </strong>We can create canvas using this <strong>Stage</strong> component. It can have one or more <strong>Layer</strong> components nested inside. Inside a layer component we can put any Groups, Shapes and Images as we want.</p><pre>import React, { useState, useEffect } from &#39;react&#39;;<br>import { Stage, Layer, Image } from &#39;react-konva&#39;;<br>import mockup from &#39;../../images/new/tshirtMockup.png&#39;;</pre><pre>const Customize = () =&gt; {</pre><pre>const [images, setImage] = useState(new window.Image());</pre><pre>useEffect(() =&gt; {<br> const MyImage = new window.Image();<br> MyImage.src = mockup;<br> MyImage.onload = () =&gt; {<br>  setImage(MyImage);<br> };<br>}, []);</pre><pre>return(<br> &lt;Stage width={850} height={500}&gt;<br>  &lt;Layer&gt; <br>   &lt;Image<br>    image={images}<br>    width={850}<br>    height={500}<br>   /&gt;<br>  &lt;/Layer&gt;<br> &lt;/Stage&gt;<br>);</pre><pre>};</pre><pre>export default Customize;</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XzcfU-UoPWZgx8NTKUzpWg.png" /></figure><p>Here we have come to the end of First tutorial of “React-Konva basics and adding a konva image” let’s meet with our 2nd tutorial “How to change the color of the t-shirt” soon. Cheers!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=71d5b3e684e7" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>