テスター時代を含め、フリーランスのエンジニアとして十数年のキャリアを重ねてきました。
思い返すと、続けて行く上で特にすごいことをしているわけじゃなく、大雑把に言うと下記の2つを真面目にやっているだけだと思う。
- こまめな進捗報告
- 問題があれば隠さず、すぐに報告する
もちろん、経験を積むにつれて技術力が向上しているとは感じますが、特別目立ったスキルがあるわけではないし、 いきなりコーディングテストと言われたら頭が真っ白になって何もできないと思う。
それでもなんとかやっております。
テスター時代を含め、フリーランスのエンジニアとして十数年のキャリアを重ねてきました。
思い返すと、続けて行く上で特にすごいことをしているわけじゃなく、大雑把に言うと下記の2つを真面目にやっているだけだと思う。
もちろん、経験を積むにつれて技術力が向上しているとは感じますが、特別目立ったスキルがあるわけではないし、 いきなりコーディングテストと言われたら頭が真っ白になって何もできないと思う。
それでもなんとかやっております。
こんな感じでテキストの横にラインが幅いっぱい引かれるパターン
<div className='flex items-center space-x-1'> <span className="text-gray-500">タグ</span> <div className="flex-1 border-b border-gray-500"></div> </div>
こんな感じでクリックするとアイコンが広がりボタンになるアニメーション
1度目のクリックでボタンになり、2度目のクリックで処理が実行されるので、確認ダイアログよりスマートな操作となる。
<div className="inline-flex items-center rounded-full p-1 bg-zinc-400 text-white group transition-all duration-100 hover:ring-1 hover:ring-rose-400 hover:bg-rose-400 hover:ring-offset-1 hover:outline-none focus:ring-1 focus:ring-rose-400 focus:bg-rose-400 focus:ring-offset-1 focus:outline-none" role="alert" tabIndex={0}> <svg className="stroke-2 w-6 h-6 p-1" xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" > <path strokeLinecap="round" strokeLinejoin="round" d="M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" /> </svg> <button onClick={() => console.log('削除処理')} className="whitespace-nowrap inline-block text-sm group-focus:max-w-screen-2xl max-w-0 group-focus:scale-100 overflow-hidden transition-all duration-300 group-focus:px-2">削除</button> </div>
butonタグ側はgroup-focus:
にしないとタップしたときボタン押された判定になり削除処理が走る。
一緒にアニメ・ゲームを楽しめるパートナーを探すなら【ヲタ婚】
1年以内の成婚率41.3%!
平均6.6ヶ月で婚約できるスマホの結婚相談所【naco-do】
選ばれて10年。エンジニアの気持ちが分かる転職エージェントは【アイムファクトリー】
※Reactです
<div className="relative"> <input type="text" className="block w-full h-10 rounded-md border-gray-300 bg-gray-100 pl-7 pr-12" placeholder="ここに入力" required /> <div className="absolute inset-y-0 right-1 flex my-2"> <button type="button" className="justify-center rounded-md border border-transparent bg-blue-400 px-4 py-1 text-sm font-bold text-white" > 検索 </button> </div> </div>
Tailwindで画面中央に配置したい場合
h-screen w-screen flex justify-center items-center
を使うことが多いと思いますが、親要素ですでにh-screen
を指定していると場合によって画面以上になってしまいます。
そんな場合は
absolute inset-0 flex items-center justify-center
で対応可能。
選ばれて10年。エンジニアの気持ちが分かる転職エージェントは【アイムファクトリー】
一緒にアニメ・ゲームを楽しめるパートナーを探すなら【ヲタ婚】
※ Reactです
<div className='min-h-screen bg-blue-300'> <div className="sticky top-0 bg-slate-800 text-white py-2"> <h1 className="uppercase font-black text-center text-2xl tracking-wider">header</h1> </div> # ここで指定 <section className="absolute inset-0 flex items-center justify-center"> <div className="py-8 px-4 mx-auto max-w-screen-xl text-center lg:py-16 lg:px-12"> <h2 className="text-4xl font-extrabold tracking-tight leading-none text-gray-700 md:text-5xl"> ここ 真ん中 にしたい </h2> <p className="text-lg font-normal text-gray-500 lg:text-xl sm:px-16 xl:px-48"> header attemo mannaka ni shitai </p> <button type="button" className="bg-blue-500 mt-6 hover:bg-blue-400 hover:shadow-lg text-gray-800 font-bold py-2 px-4 rounded inline-flex items-center" > <span className="text-white">button</span> </button> </div> </section> </div>
このように左端に戻るボタンがあっても、タイトルをセンターに表示したいときは下記でOK
戻るbuttonタグにabsolute
を付ける
タイトルのh1タグの幅をw-full
にする
1年以内の成婚率41.3%!
平均6.6ヶ月で婚約できるスマホの結婚相談所【naco-do】
<div className="flex top-0 sticky text-white"> <button type="button" className="absolute rounded-full text-gray-400 bg-transparent hover:bg-gray-200 hover:text-gray-900 rounded-lg text-sm p-1.5" > <svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="stroke-2 w-6 h-6"> <path strokeLinecap="round" strokeLinejoin="round" d="M15.75 19.5L8.25 12l7.5-7.5" /> </svg> <span className="sr-only">Back</span> </button> <h1 className="w-full text-center font-black text-3xl tracking-wider">ここがセンター</h1> </div>
IndexedDBなどから非同期で取得したデータをinputなどのデフォルト値として表示したかったけど、なかなか上手くいかなかったオッサンです。
最終的には下記の様にkeyを切り替える事でなんとか実現しました。
React Hooks 入門 - Hooksと Redux を組み合わせて最新のフロントエンド状態管理手法を習得しよう!
import React, { useState, useEffect } from 'react'; import {GetKeywoed} from '../Services/IndexedDbService' import TextField from '@material-ui/core/TextField'; export default function Sample() { const [keyword, setKeyword] = useState(''); useEffect(() => { (async () => { //非同期でデータを取得 const ret = await GetKeywoed(); setKeyword(ret.keyword); })(); },[]); return ( <div> <TextField label="キーワード" key={keyword === '' ? 'key1': 'key2'} //取得前と後でkeyを変える variant="outlined" InputLabelProps={{shrink: true,}} defaultValue={keyword} onBlur={e => setKeyword(e.target.value)} /> </div> ) }