Skip to content

Instantly share code, notes, and snippets.

const formData = useFormData({
name,
tel,
password,
});
await registerUser({
params: formData
})
@ashimon83
ashimon83 / styled-component-with-svg.tsx
Last active March 16, 2022 04:42
styled-component-with-svg-loader
import Logo from './logo.svg'
type StyledLogoProps = {
active: boolean
}
// styled-componentsでスタイル定義を直接書いて大きさを指定したり動的にpropsで状態を変化させたりできる。便利。
const StyledLogo = styled(Logo)<StyledLogoProps>`
color: ${p => p.active ? 'red' : 'blue'};
width: 20px;
@ashimon83
ashimon83 / next-svg.tsx
Last active March 16, 2022 04:42
next-svg
import Cat from '../svgs/cat.svg'
export default function Home() {
return (
<div className="container">
<marquee>SVG Cat!</marquee>
<Cat />
<style jsx>{`
.container {
width: 600px;
@ashimon83
ashimon83 / get-slash-url-param.js
Created May 28, 2021 09:24
get url param from slashed url
// /path1/123/path2/345
location.pathname.match(/\/path1\/([^\/]+)/)
// /path1/123
location.pathname.match(/\/path2\/([^\/]+)/)
// /path2/345
@ashimon83
ashimon83 / enum-like-status.ts
Created April 27, 2021 09:34
tsでenumっぽいの扱うやり方
export const SomeStatus = {
REQUESTED: '申請',
DONE: '完了',
REJECT: '差し戻し',
} as const;
export type SomeStatusType = keyof typeof SomeStatus;
@ashimon83
ashimon83 / sendTestMail.gs
Last active June 29, 2017 03:28
メール送信用Google App Script
function sendTestMail(e) {
var html = HtmlService.createHtmlOutputFromFile("message").getContent();
var items = e.response.getItemResponses();
var mailDom = '';
var mailTo = '';
var title = '';
items.forEach(function(item){
switch(item.getItem().getTitle()){
case 'mailDom':
mailDom = item.getResponse();