投稿時間:2023-07-17 18:12:58 RSSフィード2023-07-17 18:00 分まとめ(16件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
Ruby Rubyタグが付けられた新着投稿 - Qiita Railsで'application.css'以外のCSSファイルを作成する手順 https://qiita.com/PB-193/items/20dadec4b2ba0254e350 appass 2023-07-17 17:29:33
AWS AWSタグが付けられた新着投稿 - Qiita github + CircleCi + s3でCI/CDの構築 https://qiita.com/masakun1150/items/73a366c9655078d17e5d github 2023-07-17 17:20:27
AWS AWSタグが付けられた新着投稿 - Qiita Cloudformationを使用したNATゲートウェイ,VPCエンドポイントのオプション化 https://qiita.com/hiroshi_jinbo/items/e0d6f6bffb8e98f0cef3 cloudformation 2023-07-17 17:06:34
Docker dockerタグが付けられた新着投稿 - Qiita Dockerを使ってWordPressとMySQLのローカル開発環境を構築する手順 https://qiita.com/arihori13/items/98feb3b0fe84d8c59e0a docker 2023-07-17 17:48:20
Docker dockerタグが付けられた新着投稿 - Qiita 【docker】簡易的なチャットボットのReactアプリをdocker-composeで動かす https://qiita.com/yuichi1992_west/items/9208bc15e355544d39f5 arttalkapi 2023-07-17 17:08:47
Git Gitタグが付けられた新着投稿 - Qiita Gitのfetch, merge, pullって何やってるの? https://qiita.com/tonnsama/items/ed94c0d91064d0df756a fetchmerg 2023-07-17 17:16:29
Ruby Railsタグが付けられた新着投稿 - Qiita Railsで'application.css'以外のCSSファイルを作成する手順 https://qiita.com/PB-193/items/20dadec4b2ba0254e350 appass 2023-07-17 17:29:33
海外TECH DEV Community Tailwind CSS Tips and Tricks Worth Knowing https://dev.to/hamatoyogi/tailwind-css-tips-and-tricks-worth-knowing-1j00 Tailwind CSS Tips and Tricks Worth KnowingIn this blog post I m not going to say why you should use Tailwind I ve covered the whole debate enough in a previous post This time I ll explore some Tailwind tips that can significantly enhance your web development experience Whether you re a beginner or an advanced Tailwind user I hope you find something useful Let s go Dynamic utility classesTailwind purges classes that are not being used This is how it s able to have so many features and still keep our CSS bundle size small So if you want to use dynamic class names you need to have all the class names you want written somewhere in your code This is in order for Tailwind to be able to statically analyze your code For example something like this won t work const DoesntWork gt const colors red green yellow const color setColor React useState colors const changeColor gt setColor green return lt gt lt div className w h border bg color gt lt div gt lt select value color className bg color onChange e gt setColor e target value gt lt option value gt choose lt option gt colors map c gt lt option key c value c gt c lt option gt lt select gt lt button onClick changeColor gt Change color lt button gt lt gt That is because there is no way for Tailwind to find it s classes statically Having bg color needs to be evaluated in runtime However if we do use the full class names the Tailwind compiler can make it work const Works gt const colors bg red bg green bg yellow const color setColor React useState colors const changeColor gt setColor bg green return lt gt lt div className w h border color gt lt div gt lt select value color className color onChange e gt setColor e target value gt lt option value gt choose lt option gt colors map c gt lt option key c value c gt c lt option gt lt select gt lt button onClick changeColor gt Change color lt button gt lt gt Using Tailwind inside CSSThere are some times where we are forced to use CSS for our styles for example when using a third party library We can stick with the Tailwind colors by using the apply directive or the theme function Let s have a look at a code example some external class Using apply we can use any utility class name from Tailwind apply text blue bg gray py px rounded lg uppercase or using the theme function color theme colors blue background color theme colors gray padding theme padding theme padding border radius theme borderRadius lg text transform uppercase Arbitrary valuesAnother way to write pure CSS inside Tailwind is with brackets This is what is referred to as “arbitrary values You can do things like this lt div class w vw bg rebbecapurple gt lt div gt What more is that you can use the theme function as well lt div class grid grid cols fit content theme spacing gt lt gt lt div gt In case you want to reference a CSS custom property there s no need to use the var keyword since v You can simply pass in your CSS variable as an arbitrary value lt div class bg my color gt lt gt lt div gt Group and peer utility classesTailwind allows us to change the style of an element based on its state with helper classes such as hover checked disabled focus and more you can find them all here So it s easy for us to do something like this lt button class bg purple border border blue text white text xl uppercase p rounded md m transition colors hover bg purple hover border blue hover text gray gt Click me lt button gt The result would be the below What if we want to change the style based on the state of another element This is where the peer and the group utility classes come in handy Style based on parent stateFor instance we can change the style of child elements when the parent is hovered by turning the parent into a group and using group and group hover utility classes lt div class relative rounded xl overflow auto p gt lt a href class group block max w xs mx auto rounded lg p bg white ring ring slate shadow lg space y hover bg sky hover ring sky gt lt div class flex items center space x gt lt svg class h w stroke sky group hover stroke white fill none viewBox gt lt gt lt svg gt lt h class text sm text slate font semibold group hover text white gt New project lt h gt lt div gt lt p class text sm text slate group hover text white gt Create a new project from a variety of starting templates lt p gt lt a gt lt div gt Which would result in the following There are more helper classes to modify the child elements and this works for almost every pseudo class modifier here s the full list Style based on sibling stateThe peer class modifier can be used to style an element based on the state of it s sibling You can use the peer modifier where modifier can be any pseudo class modifier Here s a simple example lt div class flex flex col items center gap p bg pink gt lt p class peer cursor pointer gt I am sibling lt p gt lt p class peer hover text white gt I am sibling lt p gt lt div gt When we hover over “sibling the text will change the “sibling element You can name namesBoth with the group and peer you can give unique names to differentiate groups and peers This is done by adding name to either helper classes for example lt div class group main w vw bg purple gt lt div class group hello peer second h w full flex flex col items center justify around gt lt p class group hover hello text white gt Hello Wolrd lt p gt lt p gt All this code belogs to us lt p gt lt div gt lt div class peer hover second bg red w px h px bg blue gt lt div gt lt div class group hover main bg green peer hover main bg red w px h px bg orange gt lt div gt Register a Tailwind component to BuilderYou can register components from within your code straight into Builder io s Headless Visual CMS and allow non devs to drag and drop your custom components in the Builder UI To do so you need to have a Builder account first Then follow the docs to get set up Once you have finished setting up and you ve connected to Builder create a component in your repo using Tailwind Let s assume you re working with Next js We can create a new component src components card tsxexport const Card text text string gt return lt div className relative rounded xl overflow auto p gt lt a href className group block max w xs mx auto rounded lg p bg white ring ring slate shadow lg space y hover bg sky hover ring sky gt lt div className flex items center space x gt lt svg gt lt svg gt lt h className text sm text slate font semibold group hover text white gt New project lt h gt lt div gt lt p className text sm text slate group hover text white gt text lt p gt lt a gt lt div gt Then we register the component to Builder page tsx Register this component for use in the Visual EditorBuilder registerComponent Card name Card inputs name is the name of your prop name text type text And then we can just drag and drop our component into our app via the Builder UI as below where the left side is Builder and the right side is our connected Next js app Animation utility classesTailwind has some very useful and easy to use animation utility classes For example we can add the transition color class and set a duration of milliseconds to create a smooth color change effect on hover We can also pass an animation curve and a delay for the animation lt div class hover bg gray transition colors duration ease in out gt Almost any animatable property is available to you for a full list see here Other than that there are premade animations available like animate spin animate ping animate bounce and animate pulse Responsive designsTailwind is a mobile first framework which means that un prefixed utilities take effect on all screen sizes while the prefixed utilities override the styles at the specific breakpoint and above This helps write your CSS mobile first as you need to define from small the larger screens Let s say we want a grid of images or videos We want our design to be one column on mobile and then on larger screens be columns and on desktop have columns like so This is how we would write it lt div class grid grid cols gap p sm grid cols md grid cols gt lt div class w full aspect video bg cyan gt lt div gt lt div class w full aspect video bg cyan gt lt div gt lt div class w full aspect video bg cyan gt lt div gt lt div class w full aspect video bg cyan gt lt div gt lt div class w full aspect video bg cyan gt lt div gt lt div class w full aspect video bg cyan gt lt div gt lt div gt Custom min and max utility classes are available as well for more dynamic use cases Furthermore you can add custom breakpoints into your tailwind config js configuration file Editor extensionsThe Tailwind CSS Intellisense extension for your IDE is one of the main reasons why Tailwind is so pleasant to use It auto completes the class names for you shows you the color being used and explains the details of the class when you hover over it Other than that you can get Prettier sorting your classes with the Tailwind Prettier plugin And one more quality of life extension that might help your eye sores from a long list of classes is Tailwind Fold Creating custom utility classesWe can use the Tailwind configuration file to create our own custom utility classes This is very useful if we want to use a specific style in multiple places in our app So if we want to add another box shadow class for example this is what we d need to do tailwind config jsmodule exports content src html js theme extend boxShadow Note that we can use the theme function in here as well neon px theme colors purple px theme colors purple Then we could use it in our code lt div class w h rounded shadow neon gt lt div gt Anything in Tailwind can be extended or overridden Creating custom Tailwind pluginsIf we want to be able to choose the color of a custom utility by passing the color we need to make our own custom Tailwind plugin This is a bit advanced but it allows us to create very flexible and reusable utilities Let s reuse our neon shadow example To add that ability to it we can go to tailwind config js and define our plugin tailwind config jsconst plugin require tailwindcss plugin module exports content src js ts jsx tsx mdx theme our previous config plugins to get the colors we can use the theme property plugin theme addUtilities gt const neonUtilities const colors theme colors loop through the colors for const color in colors Check if color is an object as some colors in Tailwind are objects and some are strings if typeof colors color object we opt in to use colors const color colors color const color colors color Here we build the actual class name neonUtilities neon color boxShadow px color px color this adds the utility classes to Tailwind addUtilities neonUtilities Then we can use our newly created utility classes straight in our HTML or JSX lt div class m w h rounded lg neon blue gt lt div gt Notice that we can change to any color in the Tailwind palette we want Importing Tailwind colors as an objectWe can import Tailwind colors as an object inside JavaScript This can be extremely useful if we want to use the Tailwind colors to create our own custom theme or add another name to the color palette For example we can create a primary color that will be added as a class import all colors from Tailwindconst colors require tailwindcss colors module exports content src js ts jsx tsx mdx theme extend colors set primary class name to desired color set default primary colors sky DEFAULT colors sky plugins Using variantsA common use case when building components is having some sort of base or default style that can be overridden by passing a class or a prop The tailwind merge package is very useful to deal with this It allows us to pass the base classes as the first parameter and the class name as the second parameter ensuring that our class name overrides the default class for a deeper dive as to how this works see this video Here s an example import twMerge from tailwind merge const SpecialButton React FC lt className string gt className gt return lt button className twMerge px py bg red hover bg red className gt Click me lt button gt Then we can override the style like so some other component jsconst Component gt lt div gt lt h gt Hello lt h gt lt SpecialButton className bg blue hover bg blue gt lt div gt Bonus with Class Variant AuthorityCVA is a package to help you create variants in a more elegant way To make it work with tailwind merge we can do the following import cva type VariantProps from class variance authority import twMerge from tailwind merge const buttonVariants cva your base classes variants intent primary your primary classes defaultVariants intent primary export interface ButtonVariants extends VariantProps lt typeof buttonVariants gt export const buttonClasses variants ButtonVariants gt twMerge buttonVariants variants Easy gradientsYou can create complex gradients using gradient color stops To do so we can use the bg gradient to class and combine it with t top r right b bottom and l left We can also state corners with tr top right bl bottom left etc And then we can combine from to and via to make some stunning gradients Let s have a look at some examples the first to is specifiying the direction lt div class bg gradient to r from indigo gt the from sets which color to start at and then fades out The rendered output would be a gradient that starts with indigo and fades to transparent To set the ending we can use the to lt div class bg gradient to r from indigo to pink gt That would render a gradient that starts with indigo and fades to pink To add pizzaz we can control which color is in the middle by using via between lt div class bg gradient to r from indigo via green to pink gt That would render an almost rainbow gradient as such Truncate your text easilyAnother nifty utility class is line clamp which allows you to truncate multiline text by simply adding a number such as line clamp lt article class mt border border slate rounded md p ml text white w gt lt p class line clamp gt Nulla dolor velit adipisicing duis excepteur esse in duis nostrud occaecat mollit incididunt deserunt sunt Ut ut sunt laborum ex occaecat eu tempor labore enim adipisicing minim ad Est in quis eu dolore occaecat excepteur fugiat dolore nisi aliqua fugiat enim ut cillum Labore enim duis nostrud eu Est ut eiusmod consequat irure quis deserunt ex Enim laboris dolor magna pariatur Dolor et ad sint voluptate sunt elit mollit officia ad enim sit consectetur enim lt p gt lt article gt The rendered result will put an ellipsis after lines of text Styling the un styleableStyling things like lt input type checkbox gt has been notoriously hard No more with the accent color modifier lt label gt lt input type checkbox checked gt Browser default lt label gt lt label gt lt input type checkbox class accent pink checked gt Customized lt label gt Container queriesOne of the new CSS features that a lot of folks are rightfully excited about They allow applying styles based on the size of the element itself There s a plugin to start using them now in Tailwind called tailwindcss container queries After adding this plugin to your project an element can be mark with container and children can use variants like sm and md lt div class container gt lt div class lg text sky gt lt gt lt div gt lt div gt ConclusionAnd that s it These are just some of the many tips and tricks available to you when using Tailwind CSS With its wide range of utility classes and responsive design capabilities the possibilities are endless So get creative have fun and don t be afraid to experiment with new styles and designs With Tailwind CSS you can create beautiful and functional websites with ease Happy coding Visually build with your componentsBuilder io is a headless CMS that lets you drag and drop with your components right within your existing site Try it out Learn more Dynamically render your componentsexport function MyPage json return lt BuilderComponent content json gt registerComponents MyHero MyProducts Read the full post on the Builder io blog 2023-07-17 08:25:37
海外TECH DEV Community What is a Visual Headless CMS (aka Visual CMS)? https://dev.to/builderio/what-is-a-visual-headless-cms-aka-visual-cms-19cb What is a Visual Headless CMS aka Visual CMS This post will be discussing a cutting edge concept known as a Headless Visual CMS or Headless Visual Content Management System This is not your ordinary CMS we are not referring to platforms like WordPress Joomla Drupal Sanity io Contentful or anything like that Instead we re talking about a fusion of the best headless CMS features and the simplicity of site builders like Wix or Squarespace Let s dive deeper into this topic Get a load of this This is probably a bit different than what you re used to seeing in other CMSs ーthose blocks that are being dragged into the page are React components that come from your code base The integration code is simple and goes right within your existing site or app It looks like this import BuilderComponent builder registerComponent from builder io react export async function getStaticProps params Fetch the builder content as JSON const page await builder get page url params page join return props page export default function Page page Render the content dynamically return lt BuilderComponent model page content page gt Register your components for use in the visual editorregisterComponent MyHero registerComponent MyProductsComponent Sound interesting Let s get into it Headless CMS all muscles few smilesLet s talk about what s a headless CMS for a moment As devs you might think of the term “headless and your first association might be “headless components which are probably registered in your brain as components that only have an API and no UI What I mean are projects libraries like Headless UI RadixUI Downshift TanStack Table or a slew of others I might be forgetting A “Headless CMS on the other hand is a special breed of a content management system that focuses solely on backend functionalities Sounds a bit spooky Don t worry It just means the content is made accessible through either a GraphQL or REST API and can be displayed on pretty much any device you can think of The magic here is that the headless CMS separates the backend where you create and store content from the frontend where design and deployment happen leaving the frontend presentation out of its scope Now this separation might sound like an extra complication but it s a massive perk Why Because it gives you a whole lot more wiggle room in how and where and how your content is displayed As long as a device or platform can connect to the API it can access and consume your content Headless CMSs are like the Superman of content management for developers They re tech agnostic performance focused and scale like a charm Plus they come with plugins and extensions for the customization that big businesses crave along with roles and permissions for team workflow control But let s face it they aren t exactly user friendly They require developers to bend their components to fit into the CMS Also they are mostly endless glorified input forms ーneed an extra piece of data Here s a new input field good luck mapping it and connecting it to your UI And if the marketing team wants something new Well it s back to the dev backlog Over time this can lead to a whole bunch of developer dependencies limited structured data and some pretty serious business impacts Site builders pretty faces less gritThen you ve got site builders ーthe user friendly models like Webflow Squarespace and Wix They re all about visual appeal making building a site as easy as dragging dropping and publishing But as your site becomes more complex these models start to stumble Your site s speed and performance can take deteriorate and you re chained to the platform s capabilities Want to use the latest front ends or back end services Only if the platform supports it The best of both worlds visual CMSSo here s a thought ーwhy not take the best parts from both these worlds A platform where building is as intuitive as a site builder but provides the API based component driven high performance content management that developers love about headless CMS Enter the Visual CMS It s all about visual development with elements like text images video and more wrapped up in a Figma style editor The best part Developers get clean code and business teams control structures on these pages ーeveryone wins Unique perks of Builder io s visual headless CMSBesides the best features of headless CMSs and site builders Builder s Visual CMS brings unique capabilities to the table Unlike other visual editors Builder s visual CMS allows developers to have as much control as they want over the components your marketing design team can use inside the editor Content doesn t have to live inside code because Builder s visual CMS connects to your frontend tech stack The gist of it is you just use a component from the Builder SDK in your code base no matter if you re using Vue Svelte React Angular Solid or Qwik and then it appears in the editor UI Say you re using Next js with Tailwind for your app or site you can write some generic card component like this src components card tsxexport const Card text title text string title string gt return lt div className relative rounded xl overflow auto p gt lt a href className group block max w xs mx auto rounded lg p bg white ring ring slate shadow lg space y hover bg sky hover ring sky gt lt div className flex items center space x gt lt svg gt lt svg gt lt h className text sm text slate font semibold group hover text white gt title lt h gt lt div gt lt p className text sm text slate group hover text white gt text lt p gt lt a gt lt div gt And then you can register the component to the Builder editor page tsx Register this component for use in the Visual EditorBuilder registerComponent Card name Card inputs name is the name of your prop name text type text name title type text Fetch the builder content as JSONexport async function getStaticProps params const page await builder get page url params page join return props page Render the content dynamicallyexport default function Page page return lt BuilderComponent model page content page gt Then we just drag and drop it into our page That is what Builder is A layer between your data and your frontend code ConclusionThe benefits of a Visual CMS for your organization can be game changing It frees business teams to manage their requests and allows developers to focus on crucial projects It eliminates content development bottlenecks and speeds up growth Plus it fosters autonomy and collaboration leading to happier and more productive teams But that s not all A Visual CMS brings with it a range of optimization features and incremental adoption capabilities that take your digital experience management to the next level With its optimization features testing and personalizing your ideas is a breeze You can personalize experiences for individual visitors based on various attributes delivering top notch performant experiences And the best part You don t need to overhaul your front end or schemas A Visual CMS plays well with your existing tech stack You can use your current design system and component library bring in any data source and migrate content created in the Visual CMS to your front end choice Now imagine the possibilities A Visual CMS empowers your team to unleash their creativity and build exceptional digital experiences You have the power to transform your organization s content and digital experience management It s a big leap forward enabling you to build your way build faster and build together Now that s a win win in my book Visually build with your componentsBuilder io is a headless CMS that lets you drag and drop with your components right within your existing site Try it out Learn more Dynamically render your componentsexport function MyPage json return lt BuilderComponent content json gt registerComponents MyHero MyProducts Read the full post on the Builder io blog 2023-07-17 08:14:40
海外TECH DEV Community 2 Critical Elements of the Rubyist Mindset https://dev.to/rubycademy/2-critical-elements-of-the-rubyist-mindset-219o Critical Elements of the Rubyist MindsetIn the realm of programming a daunting battlefield awaits demanding mastery of complex problem solving and vast technical expertise But behold within the Ruby programming world a distinct mindset reigns supreme the Rubyist mindset This mindset exalts simplicity elegance and the sheer ecstasy of coding Join us on this blog post as we delve into the core principles of the Rubyist mindset Embracing SimplicityRubyists believe in the power of simplicity when writing code The following example demonstrates how Ruby allows us to express complex ideas in a concise and readable manner Calculate the sum of all even numbers between and select amp even sum gt In just one line of code we create a range of numbers from to select only the even numbersand calculate their sumThis code showcases Ruby s expressive syntax and the ability to chain methods together resulting in clear and readable code The Joy of ProgrammingRubyists find joy and fulfillment in coding considering it a creative endeavor Let s consider a simple example module PasswordGenerator CHARS A Z to a a z to a to a freeze module function def generate length Array new length CHARS sample join endendPasswordGenerator generate gt wVAlO PasswordGenerator generate gt rBH This Ruby code defines a module called PasswordGenerator that generates random passwords It includes a constant CHARS which represents a frozen array containing uppercase letters lowercase letters and numbers from to This module defines a single module function called generate The generate method takes an optional parameter length which defaults to if no argument is provided The method then generates a new array of length length using the Array new method For each element in the new array a random character is sampled from the CHARS array using the sample method Finally the resulting array is joined together into a single string and returned as the generated password Rubyists take pleasure in writing clean and concise code that achieves the desired outcome The joy of programming lies in the ability to solve problems creatively and produce solutions that are both functional and elegant ConclusionBy adopting the Rubyist mindset programmers can enhance their coding experience and produce clean elegant and maintainable code So whether you re a Rubyist or not incorporating the principles of simplicity joy and collaboration into your programming practice can transform the way you approach and experience coding ultimately leading to better solutions and a more enjoyable programming journey To go furtherYou can follow us on Twitter as we re very active on this platform Indeed we post elaborate code examples every day Also I created RubyCademy Weekly which is a weekly newsletter Uncover crucial knowledge I wish I had when starting my career as a Rails developer This newsletter provides valuable Ruby tips essential concepts and patterns I deep dive into ADVANCED TOPICS with multiple CASE STUDIES Join us and get access to our exclusive content gt gt gt RubyCademy Weekly lt lt lt 2023-07-17 08:07:56
ニュース BBC News - Home Poor quality university courses face limits on student numbers https://www.bbc.co.uk/news/uk-politics-66216005?at_medium=RSS&at_campaign=KARANGA outcomes 2023-07-17 08:43:36
ニュース BBC News - Home Terror attack survivors condemn compensation body https://www.bbc.co.uk/news/uk-66218928?at_medium=RSS&at_campaign=KARANGA report 2023-07-17 08:55:05
ニュース BBC News - Home 'Race against time' to conduct whale pod post mortems on Lewis https://www.bbc.co.uk/news/uk-scotland-highlands-islands-66220239?at_medium=RSS&at_campaign=KARANGA scotland 2023-07-17 08:12:19
ニュース BBC News - Home Flute fail: BBC presenter tries to emulate Lizzo https://www.bbc.co.uk/news/uk-66221487?at_medium=RSS&at_campaign=KARANGA breakfast 2023-07-17 08:37:44
ニュース BBC News - Home The Ashes: James Anderson replaces Ollie Robinson for England in fourth Test https://www.bbc.co.uk/sport/cricket/66221681?at_medium=RSS&at_campaign=KARANGA ollie 2023-07-17 08:56:01
ニュース BBC News - Home Lionel Messi: Inter Miami unveil Argentina forward to sold-out crowd https://www.bbc.co.uk/sport/football/66219125?at_medium=RSS&at_campaign=KARANGA lauderdale 2023-07-17 08:05:42

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)